@blocklet/payment-react 1.18.55 → 1.19.0

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 (220) hide show
  1. package/es/checkout/donate.d.ts +1 -15
  2. package/es/checkout/donate.js +301 -189
  3. package/es/checkout/form.d.ts +1 -15
  4. package/es/checkout/form.js +5 -13
  5. package/es/checkout/table.js +3 -3
  6. package/es/components/blockchain/gas.d.ts +1 -5
  7. package/es/components/blockchain/gas.js +10 -2
  8. package/es/components/blockchain/tx.d.ts +1 -8
  9. package/es/components/blockchain/tx.js +28 -7
  10. package/es/components/confirm.d.ts +1 -10
  11. package/es/components/confirm.js +4 -10
  12. package/es/components/country-select.d.ts +3 -2
  13. package/es/components/country-select.js +375 -352
  14. package/es/components/input.d.ts +11 -20
  15. package/es/components/input.js +46 -43
  16. package/es/components/lazy-loader.js +1 -2
  17. package/es/components/link.d.ts +2 -9
  18. package/es/components/link.js +9 -6
  19. package/es/components/livemode.d.ts +2 -8
  20. package/es/components/livemode.js +1 -5
  21. package/es/components/loading-button.d.ts +6 -1
  22. package/es/components/loading-button.js +56 -66
  23. package/es/components/over-due-invoice-payment.d.ts +0 -18
  24. package/es/components/over-due-invoice-payment.js +138 -95
  25. package/es/components/payment-beneficiaries.d.ts +2 -7
  26. package/es/components/payment-beneficiaries.js +86 -40
  27. package/es/components/pricing-item.d.ts +0 -5
  28. package/es/components/pricing-item.js +1 -4
  29. package/es/components/pricing-table.d.ts +2 -10
  30. package/es/components/pricing-table.js +8 -7
  31. package/es/components/resume-subscription.d.ts +0 -10
  32. package/es/components/resume-subscription.js +42 -21
  33. package/es/components/truncated-text.d.ts +2 -9
  34. package/es/components/truncated-text.js +0 -5
  35. package/es/contexts/donate.d.ts +0 -7
  36. package/es/contexts/donate.js +10 -8
  37. package/es/contexts/payment.d.ts +1 -4
  38. package/es/contexts/payment.js +7 -2
  39. package/es/history/invoice/list.d.ts +2 -18
  40. package/es/history/invoice/list.js +151 -73
  41. package/es/history/payment/list.js +115 -38
  42. package/es/hooks/keyboard.d.ts +1 -1
  43. package/es/hooks/keyboard.js +2 -4
  44. package/es/libs/cached-request.js +2 -4
  45. package/es/libs/phone-validator.js +1 -2
  46. package/es/libs/util.js +2 -4
  47. package/es/libs/validator.js +2 -4
  48. package/es/payment/amount.d.ts +2 -7
  49. package/es/payment/amount.js +1 -5
  50. package/es/payment/donation-form.d.ts +2 -10
  51. package/es/payment/donation-form.js +196 -160
  52. package/es/payment/error.d.ts +2 -8
  53. package/es/payment/error.js +40 -20
  54. package/es/payment/footer.d.ts +2 -3
  55. package/es/payment/footer.js +19 -6
  56. package/es/payment/form/addon.js +14 -4
  57. package/es/payment/form/address.d.ts +2 -9
  58. package/es/payment/form/address.js +3 -6
  59. package/es/payment/form/currency.js +45 -25
  60. package/es/payment/form/index.d.ts +2 -8
  61. package/es/payment/form/index.js +107 -65
  62. package/es/payment/form/phone.js +2 -4
  63. package/es/payment/form/stripe/form.d.ts +2 -8
  64. package/es/payment/form/stripe/form.js +1 -3
  65. package/es/payment/header.js +38 -16
  66. package/es/payment/index.d.ts +2 -9
  67. package/es/payment/index.js +5 -14
  68. package/es/payment/product-card.d.ts +2 -11
  69. package/es/payment/product-card.js +84 -50
  70. package/es/payment/product-donation.js +175 -114
  71. package/es/payment/product-item.d.ts +2 -9
  72. package/es/payment/product-item.js +185 -142
  73. package/es/payment/product-skeleton.js +2 -2
  74. package/es/payment/skeleton/donation.js +27 -7
  75. package/es/payment/skeleton/overview.js +22 -2
  76. package/es/payment/skeleton/payment.js +33 -5
  77. package/es/payment/success.d.ts +2 -9
  78. package/es/payment/success.js +41 -14
  79. package/es/payment/summary.d.ts +2 -17
  80. package/es/payment/summary.js +184 -111
  81. package/es/theme/index.d.ts +0 -5
  82. package/es/theme/index.js +2 -5
  83. package/es/theme/typography.d.ts +2 -2
  84. package/lib/checkout/donate.d.ts +1 -15
  85. package/lib/checkout/donate.js +75 -54
  86. package/lib/checkout/form.d.ts +1 -15
  87. package/lib/checkout/form.js +7 -15
  88. package/lib/checkout/table.js +4 -4
  89. package/lib/components/blockchain/gas.d.ts +1 -5
  90. package/lib/components/blockchain/gas.js +3 -2
  91. package/lib/components/blockchain/tx.d.ts +1 -8
  92. package/lib/components/blockchain/tx.js +11 -7
  93. package/lib/components/confirm.d.ts +1 -10
  94. package/lib/components/confirm.js +5 -11
  95. package/lib/components/country-select.d.ts +3 -2
  96. package/lib/components/country-select.js +23 -22
  97. package/lib/components/input.d.ts +11 -20
  98. package/lib/components/input.js +20 -23
  99. package/lib/components/lazy-loader.js +1 -1
  100. package/lib/components/link.d.ts +2 -9
  101. package/lib/components/link.js +3 -8
  102. package/lib/components/livemode.d.ts +2 -8
  103. package/lib/components/livemode.js +3 -7
  104. package/lib/components/loading-button.d.ts +6 -1
  105. package/lib/components/loading-button.js +9 -17
  106. package/lib/components/over-due-invoice-payment.d.ts +0 -18
  107. package/lib/components/over-due-invoice-payment.js +31 -33
  108. package/lib/components/payment-beneficiaries.d.ts +2 -7
  109. package/lib/components/payment-beneficiaries.js +12 -11
  110. package/lib/components/pricing-item.d.ts +0 -5
  111. package/lib/components/pricing-item.js +2 -5
  112. package/lib/components/pricing-table.d.ts +2 -10
  113. package/lib/components/pricing-table.js +5 -11
  114. package/lib/components/resume-subscription.d.ts +0 -10
  115. package/lib/components/resume-subscription.js +16 -16
  116. package/lib/components/table.js +1 -1
  117. package/lib/components/truncated-text.d.ts +2 -9
  118. package/lib/components/truncated-text.js +1 -6
  119. package/lib/contexts/donate.d.ts +0 -7
  120. package/lib/contexts/donate.js +4 -7
  121. package/lib/contexts/payment.d.ts +1 -4
  122. package/lib/contexts/payment.js +4 -7
  123. package/lib/history/invoice/list.d.ts +2 -18
  124. package/lib/history/invoice/list.js +49 -37
  125. package/lib/history/payment/list.js +30 -16
  126. package/lib/hooks/keyboard.d.ts +1 -1
  127. package/lib/hooks/mobile.js +1 -1
  128. package/lib/hooks/subscription.js +1 -1
  129. package/lib/index.js +2 -2
  130. package/lib/libs/api.js +1 -1
  131. package/lib/libs/dayjs.js +1 -1
  132. package/lib/libs/phone-validator.js +0 -2
  133. package/lib/libs/theme.js +1 -1
  134. package/lib/libs/util.js +1 -1
  135. package/lib/libs/validator.js +1 -1
  136. package/lib/locales/en.js +1 -1
  137. package/lib/locales/index.js +1 -1
  138. package/lib/locales/zh.js +1 -1
  139. package/lib/payment/amount.d.ts +2 -7
  140. package/lib/payment/amount.js +2 -6
  141. package/lib/payment/donation-form.d.ts +2 -10
  142. package/lib/payment/donation-form.js +33 -38
  143. package/lib/payment/error.d.ts +2 -8
  144. package/lib/payment/error.js +11 -13
  145. package/lib/payment/footer.d.ts +2 -3
  146. package/lib/payment/footer.js +5 -5
  147. package/lib/payment/form/addon.js +5 -3
  148. package/lib/payment/form/address.d.ts +2 -9
  149. package/lib/payment/form/address.js +5 -8
  150. package/lib/payment/form/currency.js +3 -3
  151. package/lib/payment/form/index.d.ts +2 -8
  152. package/lib/payment/form/index.js +19 -15
  153. package/lib/payment/form/phone.js +1 -1
  154. package/lib/payment/form/stripe/form.d.ts +2 -8
  155. package/lib/payment/form/stripe/form.js +3 -6
  156. package/lib/payment/header.js +8 -4
  157. package/lib/payment/index.d.ts +2 -9
  158. package/lib/payment/index.js +7 -16
  159. package/lib/payment/product-card.d.ts +2 -11
  160. package/lib/payment/product-card.js +13 -20
  161. package/lib/payment/product-donation.js +71 -66
  162. package/lib/payment/product-item.d.ts +2 -9
  163. package/lib/payment/product-item.js +24 -25
  164. package/lib/payment/product-skeleton.js +2 -2
  165. package/lib/payment/skeleton/donation.js +8 -4
  166. package/lib/payment/skeleton/overview.js +6 -2
  167. package/lib/payment/skeleton/payment.js +9 -3
  168. package/lib/payment/success.d.ts +2 -9
  169. package/lib/payment/success.js +12 -15
  170. package/lib/payment/summary.d.ts +2 -17
  171. package/lib/payment/summary.js +44 -45
  172. package/lib/theme/index.d.ts +0 -5
  173. package/lib/theme/index.js +2 -5
  174. package/lib/theme/typography.d.ts +2 -2
  175. package/package.json +40 -40
  176. package/src/checkout/donate.tsx +103 -35
  177. package/src/checkout/form.tsx +5 -14
  178. package/src/checkout/table.tsx +3 -3
  179. package/src/components/blockchain/gas.tsx +5 -3
  180. package/src/components/blockchain/tx.tsx +22 -8
  181. package/src/components/confirm.tsx +4 -11
  182. package/src/components/country-select.tsx +391 -378
  183. package/src/components/input.tsx +49 -45
  184. package/src/components/link.tsx +9 -7
  185. package/src/components/livemode.tsx +2 -6
  186. package/src/components/loading-button.tsx +63 -76
  187. package/src/components/over-due-invoice-payment.tsx +43 -28
  188. package/src/components/payment-beneficiaries.tsx +33 -14
  189. package/src/components/pricing-item.tsx +1 -4
  190. package/src/components/pricing-table.tsx +8 -8
  191. package/src/components/resume-subscription.tsx +20 -14
  192. package/src/components/table.tsx +2 -2
  193. package/src/components/truncated-text.tsx +0 -6
  194. package/src/contexts/donate.tsx +6 -7
  195. package/src/contexts/payment.tsx +7 -3
  196. package/src/history/invoice/list.tsx +74 -35
  197. package/src/history/payment/list.tsx +53 -16
  198. package/src/hooks/keyboard.ts +1 -1
  199. package/src/payment/amount.tsx +1 -6
  200. package/src/payment/donation-form.tsx +47 -29
  201. package/src/payment/error.tsx +16 -8
  202. package/src/payment/footer.tsx +11 -3
  203. package/src/payment/form/addon.tsx +6 -1
  204. package/src/payment/form/address.tsx +3 -7
  205. package/src/payment/form/currency.tsx +12 -2
  206. package/src/payment/form/index.tsx +30 -12
  207. package/src/payment/form/stripe/form.tsx +1 -5
  208. package/src/payment/header.tsx +14 -2
  209. package/src/payment/index.tsx +10 -21
  210. package/src/payment/product-card.tsx +41 -18
  211. package/src/payment/product-donation.tsx +85 -47
  212. package/src/payment/product-item.tsx +46 -24
  213. package/src/payment/product-skeleton.tsx +3 -2
  214. package/src/payment/skeleton/donation.tsx +12 -2
  215. package/src/payment/skeleton/overview.tsx +12 -2
  216. package/src/payment/skeleton/payment.tsx +16 -3
  217. package/src/payment/success.tsx +26 -15
  218. package/src/payment/summary.tsx +74 -42
  219. package/src/theme/index.tsx +5 -8
  220. package/src/theme/typography.ts +2 -2
@@ -1,25 +1,16 @@
1
- import { type ReactNode } from 'react';
1
+ import React, { type ReactNode } from 'react';
2
+ import type { TextFieldProps } from '@mui/material';
2
3
  import type { RegisterOptions } from 'react-hook-form';
3
- declare const FormInput: import("react").ForwardRefExoticComponent<(Omit<import("@mui/material").OutlinedTextFieldProps & {
4
+ type InputProps = TextFieldProps & {
4
5
  name: string;
5
6
  label?: ReactNode;
6
7
  placeholder?: string;
7
- errorPosition?: "right" | "bottom";
8
+ errorPosition?: 'right' | 'bottom';
8
9
  rules?: RegisterOptions;
9
- wrapperStyle?: any;
10
- }, "ref"> | Omit<import("@mui/material").FilledTextFieldProps & {
11
- name: string;
12
- label?: ReactNode;
13
- placeholder?: string;
14
- errorPosition?: "right" | "bottom";
15
- rules?: RegisterOptions;
16
- wrapperStyle?: any;
17
- }, "ref"> | Omit<import("@mui/material").StandardTextFieldProps & {
18
- name: string;
19
- label?: ReactNode;
20
- placeholder?: string;
21
- errorPosition?: "right" | "bottom";
22
- rules?: RegisterOptions;
23
- wrapperStyle?: any;
24
- }, "ref">) & import("react").RefAttributes<HTMLInputElement>>;
25
- export default FormInput;
10
+ wrapperStyle?: React.CSSProperties;
11
+ };
12
+ export default function FormInput({ ref, name, label, placeholder, rules, errorPosition, wrapperStyle, inputProps, ...rest }: InputProps & {
13
+ ref?: React.RefObject<HTMLInputElement>;
14
+ inputProps?: TextFieldProps['inputProps'];
15
+ }): JSX.Element;
16
+ export {};
@@ -1,54 +1,57 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { forwardRef, useImperativeHandle, useRef } from "react";
2
+ import { useImperativeHandle, useRef } from "react";
3
3
  import { Box, FormLabel, InputAdornment, TextField, Typography } from "@mui/material";
4
4
  import get from "lodash/get";
5
5
  import { Controller, useFormContext } from "react-hook-form";
6
6
  function FormInputError({ error }) {
7
7
  return /* @__PURE__ */ jsx(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx(Typography, { component: "span", color: "error", children: error }) });
8
8
  }
9
- const FormInput = forwardRef(
10
- ({ name, label, placeholder, rules, errorPosition, wrapperStyle, ...rest }, ref) => {
11
- const { control, formState } = useFormContext();
12
- const inputRef = useRef(null);
13
- useImperativeHandle(ref, () => {
14
- return inputRef.current;
15
- });
16
- const error = get(formState.errors, name)?.message;
17
- return /* @__PURE__ */ jsx(
18
- Controller,
19
- {
20
- name,
21
- control,
22
- rules,
23
- render: ({ field }) => /* @__PURE__ */ jsxs(Box, { sx: { width: "100%", ...wrapperStyle }, children: [
24
- !!label && /* @__PURE__ */ jsx(FormLabel, { sx: { color: "text.primary" }, children: label }),
25
- /* @__PURE__ */ jsx(
26
- TextField,
27
- {
28
- fullWidth: true,
29
- error: !!get(formState.errors, name),
30
- helperText: errorPosition === "bottom" && error ? error : "",
31
- placeholder,
32
- size: "small",
33
- ...field,
34
- ...rest,
35
- inputRef,
36
- InputProps: Object.assign(
9
+ export default function FormInput({
10
+ ref = void 0,
11
+ name,
12
+ label = "",
13
+ placeholder = "",
14
+ rules = {},
15
+ errorPosition = "bottom",
16
+ wrapperStyle = {},
17
+ inputProps = {},
18
+ ...rest
19
+ }) {
20
+ const { control, formState } = useFormContext();
21
+ const inputRef = useRef(null);
22
+ useImperativeHandle(ref, () => {
23
+ return inputRef.current;
24
+ });
25
+ const error = get(formState.errors, name)?.message;
26
+ return /* @__PURE__ */ jsx(
27
+ Controller,
28
+ {
29
+ name,
30
+ control,
31
+ rules,
32
+ render: ({ field }) => /* @__PURE__ */ jsxs(Box, { sx: { width: "100%", ...wrapperStyle }, children: [
33
+ !!label && /* @__PURE__ */ jsx(FormLabel, { sx: { color: "text.primary" }, children: label }),
34
+ /* @__PURE__ */ jsx(
35
+ TextField,
36
+ {
37
+ fullWidth: true,
38
+ error: !!get(formState.errors, name),
39
+ helperText: errorPosition === "bottom" && error ? error : "",
40
+ placeholder,
41
+ size: "small",
42
+ ...field,
43
+ ...rest,
44
+ inputRef,
45
+ slotProps: {
46
+ htmlInput: inputProps,
47
+ input: Object.assign(
37
48
  rest.InputProps || {},
38
49
  errorPosition === "right" && error ? { endAdornment: /* @__PURE__ */ jsx(FormInputError, { error }) } : {}
39
50
  )
40
51
  }
41
- )
42
- ] })
43
- }
44
- );
45
- }
46
- );
47
- FormInput.defaultProps = {
48
- label: "",
49
- placeholder: "",
50
- errorPosition: "bottom",
51
- rules: {},
52
- wrapperStyle: {}
53
- };
54
- export default FormInput;
52
+ }
53
+ )
54
+ ] })
55
+ }
56
+ );
57
+ }
@@ -12,8 +12,7 @@ export function createLazyComponent(loader, options = {}) {
12
12
  ] })
13
13
  } = options;
14
14
  const loadComponent = async () => {
15
- if (loadPromise)
16
- return loadPromise;
15
+ if (loadPromise) return loadPromise;
17
16
  try {
18
17
  loadPromise = loader().then((result) => "default" in result ? result.default : result);
19
18
  return await loadPromise;
@@ -6,12 +6,5 @@ interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
6
6
  target?: string;
7
7
  outLink?: boolean;
8
8
  }
9
- declare function Link({ to, children, onClick, replace, target, outLink, ...props }: LinkProps): JSX.Element;
10
- declare namespace Link {
11
- var defaultProps: {
12
- replace: boolean;
13
- target: undefined;
14
- outLink: boolean;
15
- };
16
- }
17
- export default Link;
9
+ export default function Link({ to, children, onClick, replace, target, outLink, ...props }: LinkProps): JSX.Element;
10
+ export {};
@@ -1,6 +1,14 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useNavigate } from "react-router-dom";
3
- export default function Link({ to, children, onClick, replace, target, outLink = false, ...props }) {
3
+ export default function Link({
4
+ to,
5
+ children,
6
+ onClick,
7
+ replace = false,
8
+ target = void 0,
9
+ outLink = false,
10
+ ...props
11
+ }) {
4
12
  const navigate = useNavigate();
5
13
  const handleClick = (e) => {
6
14
  const isInternal = to.startsWith("/") || to.startsWith("#") || to.startsWith("?");
@@ -16,8 +24,3 @@ export default function Link({ to, children, onClick, replace, target, outLink =
16
24
  };
17
25
  return /* @__PURE__ */ jsx("a", { href: to, onClick: handleClick, target, rel: "noreferrer", ...props, children });
18
26
  }
19
- Link.defaultProps = {
20
- replace: false,
21
- target: void 0,
22
- outLink: false
23
- };
@@ -3,11 +3,5 @@ type Props = {
3
3
  color?: string;
4
4
  backgroundColor?: string;
5
5
  } & ChipOwnProps;
6
- declare function Livemode({ color, backgroundColor, sx }: Props): import("react").JSX.Element;
7
- declare namespace Livemode {
8
- var defaultProps: {
9
- color: string;
10
- backgroundColor: string;
11
- };
12
- }
13
- export default Livemode;
6
+ export default function Livemode({ color, backgroundColor, sx }: Props): import("react").JSX.Element;
7
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
3
3
  import { Chip } from "@mui/material";
4
- export default function Livemode({ color, backgroundColor, sx }) {
4
+ export default function Livemode({ color = "#bb5504", backgroundColor = "#ffde92", sx }) {
5
5
  const { t } = useLocaleContext();
6
6
  return /* @__PURE__ */ jsx(
7
7
  Chip,
@@ -24,7 +24,3 @@ export default function Livemode({ color, backgroundColor, sx }) {
24
24
  }
25
25
  );
26
26
  }
27
- Livemode.defaultProps = {
28
- color: "#bb5504",
29
- backgroundColor: "#ffde92"
30
- };
@@ -6,5 +6,10 @@ export interface LoadingButtonProps extends ButtonProps {
6
6
  loadingProps?: Partial<CircularProgressProps>;
7
7
  loadingOnly?: boolean;
8
8
  }
9
- declare const LoadingButton: import("react").ForwardRefExoticComponent<Omit<LoadingButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
9
+ declare function LoadingButton({ ref, children, loading, loadingPosition, loadingIndicator, loadingProps, loadingOnly, onClick, sx, ...props }: LoadingButtonProps & {
10
+ ref?: React.RefObject<HTMLButtonElement>;
11
+ }): import("react").JSX.Element;
12
+ declare namespace LoadingButton {
13
+ var displayName: string;
14
+ }
10
15
  export default LoadingButton;
@@ -4,72 +4,62 @@ import {
4
4
  CircularProgress,
5
5
  Typography
6
6
  } from "@mui/material";
7
- import { forwardRef } from "react";
8
- const LoadingButton = forwardRef(
9
- ({
10
- children,
11
- loading,
12
- loadingPosition = "start",
13
- loadingIndicator,
14
- loadingProps = {},
15
- onClick,
16
- sx,
17
- loadingOnly = false,
18
- ...props
19
- }, ref) => {
20
- const handleClick = (e) => {
21
- if (loading) {
22
- return;
23
- }
24
- onClick?.(e);
7
+ export default function LoadingButton({
8
+ ref = void 0,
9
+ children,
10
+ loading = false,
11
+ loadingPosition = "start",
12
+ loadingIndicator = void 0,
13
+ loadingProps = {},
14
+ loadingOnly = false,
15
+ onClick,
16
+ sx,
17
+ ...props
18
+ }) {
19
+ const handleClick = (e) => {
20
+ if (loading) {
21
+ return;
22
+ }
23
+ onClick?.(e);
24
+ };
25
+ const getPositionStyles = (position) => {
26
+ return {
27
+ color: "inherit",
28
+ ...position === "start" && { mr: 1 },
29
+ ...position === "end" && { ml: 1 },
30
+ ...position === "center" && {
31
+ position: "absolute",
32
+ left: "50%",
33
+ transform: "translateY(-50%) translateX(-50%)",
34
+ top: "50%"
35
+ },
36
+ display: "inline-flex",
37
+ alignItems: "center"
25
38
  };
26
- const getPositionStyles = (position) => {
27
- return {
28
- color: "inherit",
29
- ...position === "start" && { mr: 1 },
30
- ...position === "end" && { ml: 1 },
31
- ...position === "center" && {
32
- position: "absolute",
33
- left: "50%",
34
- transform: "translateY(-50%) translateX(-50%)",
35
- top: "50%"
36
- },
39
+ };
40
+ const defaultIndicator = /* @__PURE__ */ jsx(CircularProgress, { size: 16, ...loadingProps, sx: { color: "inherit", ...loadingProps?.sx || {} } });
41
+ const indicator = /* @__PURE__ */ jsx(Typography, { sx: getPositionStyles(loadingPosition), children: loadingIndicator || defaultIndicator });
42
+ return /* @__PURE__ */ jsxs(
43
+ Button,
44
+ {
45
+ ref,
46
+ disabled: props.disabled || loading,
47
+ onClick: handleClick,
48
+ sx: {
49
+ position: "relative",
37
50
  display: "inline-flex",
38
- alignItems: "center"
39
- };
40
- };
41
- const defaultIndicator = /* @__PURE__ */ jsx(CircularProgress, { size: 16, ...loadingProps, sx: { color: "inherit", ...loadingProps?.sx || {} } });
42
- const indicator = /* @__PURE__ */ jsx(Typography, { sx: getPositionStyles(loadingPosition), children: loadingIndicator || defaultIndicator });
43
- return /* @__PURE__ */ jsxs(
44
- Button,
45
- {
46
- ref,
47
- disabled: props.disabled || loading,
48
- onClick: handleClick,
49
- sx: {
50
- position: "relative",
51
- display: "inline-flex",
52
- alignItems: "center",
53
- justifyContent: "center",
54
- ...sx
55
- },
56
- ...props,
57
- children: [
58
- loading && loadingPosition === "start" && indicator,
59
- /* @__PURE__ */ jsx(Typography, { sx: { visibility: loading && loadingOnly ? "hidden" : "visible" }, children }),
60
- loading && loadingPosition === "center" && indicator,
61
- loading && loadingPosition === "end" && indicator
62
- ]
63
- }
64
- );
65
- }
66
- );
51
+ alignItems: "center",
52
+ justifyContent: "center",
53
+ ...sx
54
+ },
55
+ ...props,
56
+ children: [
57
+ loading && loadingPosition === "start" && indicator,
58
+ /* @__PURE__ */ jsx(Typography, { sx: { visibility: loading && loadingOnly ? "hidden" : "visible" }, children }),
59
+ loading && loadingPosition === "center" && indicator,
60
+ loading && loadingPosition === "end" && indicator
61
+ ]
62
+ }
63
+ );
64
+ }
67
65
  LoadingButton.displayName = "LoadingButton";
68
- LoadingButton.defaultProps = {
69
- loading: false,
70
- loadingIndicator: void 0,
71
- loadingPosition: "start",
72
- loadingProps: {},
73
- loadingOnly: false
74
- };
75
- export default LoadingButton;
@@ -35,22 +35,4 @@ type SummaryItem = {
35
35
  method: PaymentMethod;
36
36
  };
37
37
  declare function OverdueInvoicePayment({ subscriptionId, customerId, mode, dialogProps, children, onPaid, detailLinkOptions, successToast, alertMessage, authToken, }: Props): import("react").JSX.Element | null;
38
- declare namespace OverdueInvoicePayment {
39
- var defaultProps: {
40
- mode: string;
41
- onPaid: () => void;
42
- dialogProps: {
43
- open: boolean;
44
- };
45
- children: null;
46
- detailLinkOptions: {
47
- enabled: boolean;
48
- };
49
- subscriptionId: undefined;
50
- customerId: undefined;
51
- successToast: boolean;
52
- alertMessage: string;
53
- authToken: undefined;
54
- };
55
- }
56
38
  export default OverdueInvoicePayment;
@@ -28,17 +28,19 @@ const fetchOverdueInvoices = async (params) => {
28
28
  return res.data;
29
29
  };
30
30
  function OverdueInvoicePayment({
31
- subscriptionId,
32
- customerId,
31
+ subscriptionId = void 0,
32
+ customerId = void 0,
33
33
  mode = "default",
34
- dialogProps = {},
35
- children,
34
+ dialogProps = {
35
+ open: true
36
+ },
37
+ children = void 0,
36
38
  onPaid = () => {
37
39
  },
38
40
  detailLinkOptions = { enabled: true },
39
41
  successToast = true,
40
42
  alertMessage = "",
41
- authToken
43
+ authToken = void 0
42
44
  }) {
43
45
  const { t, locale } = useLocaleContext();
44
46
  const theme = useTheme();
@@ -344,105 +346,146 @@ function OverdueInvoicePayment({
344
346
  title: dialogProps?.title || t("payment.subscription.overdue.pastDue"),
345
347
  sx: { "& .MuiDialogContent-root": { pt: 0 } },
346
348
  onClose: handleClose,
347
- children: error ? /* @__PURE__ */ jsx(Alert, { severity: "error", children: error.message }) : /* @__PURE__ */ jsxs(Stack, { gap: 1, children: [
348
- summaryList.length === 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
349
- /* @__PURE__ */ jsx(Alert, { severity: "success", children: getEmptyStateMessage() }),
350
- /* @__PURE__ */ jsx(Stack, { direction: "row", justifyContent: "flex-end", mt: 2, children: /* @__PURE__ */ jsx(Button, { variant: "outlined", color: "primary", onClick: handleClose, sx: { width: "fit-content" }, children: t("common.know") }) })
351
- ] }),
352
- summaryList.length === 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
353
- /* @__PURE__ */ jsxs(Typography, { color: "text.secondary", variant: "body1", children: [
354
- getOverdueTitle(),
355
- detailLinkOptions.enabled && /* @__PURE__ */ jsxs(Fragment, { children: [
356
- /* @__PURE__ */ jsx("br", {}),
357
- t("payment.subscription.overdue.description"),
349
+ children: error ? /* @__PURE__ */ jsx(Alert, { severity: "error", children: error.message }) : /* @__PURE__ */ jsxs(
350
+ Stack,
351
+ {
352
+ sx: {
353
+ gap: 1
354
+ },
355
+ children: [
356
+ summaryList.length === 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
357
+ /* @__PURE__ */ jsx(Alert, { severity: "success", children: getEmptyStateMessage() }),
358
358
  /* @__PURE__ */ jsx(
359
- "a",
359
+ Stack,
360
360
  {
361
- href: detailUrl,
362
- target: "_blank",
363
- onClick: handleViewDetailClick,
364
- rel: "noreferrer",
365
- style: { color: theme.palette.text.link },
366
- children: getDetailLinkText()
361
+ direction: "row",
362
+ sx: {
363
+ justifyContent: "flex-end",
364
+ mt: 2
365
+ },
366
+ children: /* @__PURE__ */ jsx(Button, { variant: "outlined", color: "primary", onClick: handleClose, sx: { width: "fit-content" }, children: t("common.know") })
367
367
  }
368
368
  )
369
- ] })
370
- ] }),
371
- /* @__PURE__ */ jsxs(Stack, { direction: "row", justifyContent: "flex-end", gap: 2, mt: 2, children: [
372
- /* @__PURE__ */ jsx(Button, { variant: "outlined", color: "primary", onClick: handleClose, children: t("common.cancel") }),
373
- renderPayButton(summaryList[0])
374
- ] })
375
- ] }),
376
- summaryList.length > 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
377
- /* @__PURE__ */ jsxs(Typography, { color: "text.secondary", variant: "body1", children: [
378
- getOverdueTitle(),
379
- detailLinkOptions.enabled && /* @__PURE__ */ jsxs(Fragment, { children: [
380
- /* @__PURE__ */ jsx("br", {}),
381
- t("payment.subscription.overdue.description"),
382
- /* @__PURE__ */ jsx(
383
- "a",
369
+ ] }),
370
+ summaryList.length === 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
371
+ /* @__PURE__ */ jsxs(
372
+ Typography,
384
373
  {
385
- href: detailUrl,
386
- target: "_blank",
387
- rel: "noreferrer",
388
- onClick: handleViewDetailClick,
389
- style: { color: theme.palette.text.link },
390
- children: getDetailLinkText()
374
+ variant: "body1",
375
+ sx: {
376
+ color: "text.secondary"
377
+ },
378
+ children: [
379
+ getOverdueTitle(),
380
+ detailLinkOptions.enabled && /* @__PURE__ */ jsxs(Fragment, { children: [
381
+ /* @__PURE__ */ jsx("br", {}),
382
+ t("payment.subscription.overdue.description"),
383
+ /* @__PURE__ */ jsx(
384
+ "a",
385
+ {
386
+ href: detailUrl,
387
+ target: "_blank",
388
+ onClick: handleViewDetailClick,
389
+ rel: "noreferrer",
390
+ style: { color: theme.palette.text.link },
391
+ children: getDetailLinkText()
392
+ }
393
+ )
394
+ ] })
395
+ ]
396
+ }
397
+ ),
398
+ /* @__PURE__ */ jsxs(
399
+ Stack,
400
+ {
401
+ direction: "row",
402
+ sx: {
403
+ justifyContent: "flex-end",
404
+ gap: 2,
405
+ mt: 2
406
+ },
407
+ children: [
408
+ /* @__PURE__ */ jsx(Button, { variant: "outlined", color: "primary", onClick: handleClose, children: t("common.cancel") }),
409
+ renderPayButton(summaryList[0])
410
+ ]
391
411
  }
392
412
  )
393
- ] })
394
- ] }),
395
- /* @__PURE__ */ jsx(Typography, { color: "text.secondary", variant: "body1", children: t("payment.subscription.overdue.list") }),
396
- /* @__PURE__ */ jsx(Stack, { children: summaryList.map((item) => /* @__PURE__ */ jsxs(
397
- Stack,
398
- {
399
- direction: "row",
400
- justifyContent: "space-between",
401
- alignItems: "center",
402
- sx: {
403
- py: 1,
404
- px: 0.5,
405
- borderBottom: "1px solid",
406
- borderColor: "grey.200",
407
- "&:hover": {
408
- backgroundColor: () => theme.palette.grey[100]
409
- },
410
- mt: 0
411
- },
412
- children: [
413
- /* @__PURE__ */ jsx(Typography, { children: t("payment.subscription.overdue.total", {
414
- total: formatAmount(item?.amount, item?.currency?.decimal),
415
- currency: item?.currency?.symbol,
416
- method: getMethodText(item?.method)
417
- }) }),
418
- renderPayButton(item, false, {
419
- variant: "text",
413
+ ] }),
414
+ summaryList.length > 1 && /* @__PURE__ */ jsxs(Fragment, { children: [
415
+ /* @__PURE__ */ jsxs(
416
+ Typography,
417
+ {
418
+ variant: "body1",
420
419
  sx: {
421
- color: "text.link"
422
- }
423
- })
424
- ]
425
- },
426
- item?.currency?.id
427
- )) })
428
- ] })
429
- ] })
420
+ color: "text.secondary"
421
+ },
422
+ children: [
423
+ getOverdueTitle(),
424
+ detailLinkOptions.enabled && /* @__PURE__ */ jsxs(Fragment, { children: [
425
+ /* @__PURE__ */ jsx("br", {}),
426
+ t("payment.subscription.overdue.description"),
427
+ /* @__PURE__ */ jsx(
428
+ "a",
429
+ {
430
+ href: detailUrl,
431
+ target: "_blank",
432
+ rel: "noreferrer",
433
+ onClick: handleViewDetailClick,
434
+ style: { color: theme.palette.text.link },
435
+ children: getDetailLinkText()
436
+ }
437
+ )
438
+ ] })
439
+ ]
440
+ }
441
+ ),
442
+ /* @__PURE__ */ jsx(
443
+ Typography,
444
+ {
445
+ variant: "body1",
446
+ sx: {
447
+ color: "text.secondary"
448
+ },
449
+ children: t("payment.subscription.overdue.list")
450
+ }
451
+ ),
452
+ /* @__PURE__ */ jsx(Stack, { children: summaryList.map((item) => /* @__PURE__ */ jsxs(
453
+ Stack,
454
+ {
455
+ direction: "row",
456
+ sx: {
457
+ justifyContent: "space-between",
458
+ alignItems: "center",
459
+ py: 1,
460
+ px: 0.5,
461
+ borderBottom: "1px solid",
462
+ borderColor: "grey.200",
463
+ "&:hover": {
464
+ backgroundColor: () => theme.palette.grey[100]
465
+ },
466
+ mt: 0
467
+ },
468
+ children: [
469
+ /* @__PURE__ */ jsx(Typography, { children: t("payment.subscription.overdue.total", {
470
+ total: formatAmount(item?.amount, item?.currency?.decimal),
471
+ currency: item?.currency?.symbol,
472
+ method: getMethodText(item?.method)
473
+ }) }),
474
+ renderPayButton(item, false, {
475
+ variant: "text",
476
+ sx: {
477
+ color: "text.link"
478
+ }
479
+ })
480
+ ]
481
+ },
482
+ item?.currency?.id
483
+ )) })
484
+ ] })
485
+ ]
486
+ }
487
+ )
430
488
  }
431
489
  );
432
490
  }
433
- OverdueInvoicePayment.defaultProps = {
434
- mode: "default",
435
- onPaid: () => {
436
- },
437
- dialogProps: {
438
- open: true
439
- },
440
- children: null,
441
- detailLinkOptions: { enabled: true },
442
- subscriptionId: void 0,
443
- customerId: void 0,
444
- successToast: true,
445
- alertMessage: "",
446
- authToken: void 0
447
- };
448
491
  export default OverdueInvoicePayment;