@blocklet/payment-react 1.18.6 → 1.18.8

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 (70) hide show
  1. package/README.md +394 -341
  2. package/es/checkout/donate.d.ts +29 -4
  3. package/es/checkout/donate.js +193 -95
  4. package/es/components/livemode.js +1 -1
  5. package/es/components/loading-button.d.ts +10 -0
  6. package/es/components/loading-button.js +75 -0
  7. package/es/components/pricing-table.js +2 -3
  8. package/es/components/table.js +1 -1
  9. package/es/index.d.ts +2 -1
  10. package/es/index.js +3 -1
  11. package/es/libs/util.d.ts +1 -0
  12. package/es/libs/util.js +10 -1
  13. package/es/payment/amount.js +1 -1
  14. package/es/payment/form/index.js +14 -12
  15. package/es/payment/form/stripe/form.js +20 -5
  16. package/es/payment/index.js +0 -1
  17. package/es/payment/product-card.js +2 -2
  18. package/es/payment/product-item.js +1 -1
  19. package/es/payment/product-skeleton.js +2 -2
  20. package/es/payment/skeleton/donation.js +1 -1
  21. package/es/payment/skeleton/overview.js +1 -1
  22. package/es/payment/skeleton/payment.js +1 -1
  23. package/es/payment/summary.js +2 -2
  24. package/es/theme/index.js +5 -3
  25. package/es/theme/typography.js +8 -8
  26. package/lib/checkout/donate.d.ts +29 -4
  27. package/lib/checkout/donate.js +197 -136
  28. package/lib/components/livemode.js +1 -1
  29. package/lib/components/loading-button.d.ts +10 -0
  30. package/lib/components/loading-button.js +86 -0
  31. package/lib/components/pricing-table.js +3 -4
  32. package/lib/components/table.js +1 -1
  33. package/lib/index.d.ts +2 -1
  34. package/lib/index.js +8 -0
  35. package/lib/libs/util.d.ts +1 -0
  36. package/lib/libs/util.js +7 -0
  37. package/lib/payment/amount.js +1 -1
  38. package/lib/payment/form/index.js +14 -15
  39. package/lib/payment/form/stripe/form.js +25 -6
  40. package/lib/payment/index.js +0 -1
  41. package/lib/payment/product-card.js +2 -2
  42. package/lib/payment/product-item.js +1 -1
  43. package/lib/payment/product-skeleton.js +2 -2
  44. package/lib/payment/skeleton/donation.js +1 -1
  45. package/lib/payment/skeleton/overview.js +1 -1
  46. package/lib/payment/skeleton/payment.js +1 -1
  47. package/lib/payment/summary.js +4 -4
  48. package/lib/theme/index.js +5 -3
  49. package/lib/theme/typography.js +8 -8
  50. package/package.json +8 -8
  51. package/src/checkout/donate.tsx +209 -128
  52. package/src/components/livemode.tsx +1 -1
  53. package/src/components/loading-button.tsx +100 -0
  54. package/src/components/pricing-table.tsx +3 -3
  55. package/src/components/table.tsx +1 -1
  56. package/src/index.ts +2 -0
  57. package/src/libs/util.ts +11 -1
  58. package/src/payment/amount.tsx +1 -1
  59. package/src/payment/form/index.tsx +65 -60
  60. package/src/payment/form/stripe/form.tsx +21 -6
  61. package/src/payment/index.tsx +0 -1
  62. package/src/payment/product-card.tsx +2 -2
  63. package/src/payment/product-item.tsx +1 -1
  64. package/src/payment/product-skeleton.tsx +2 -2
  65. package/src/payment/skeleton/donation.tsx +1 -1
  66. package/src/payment/skeleton/overview.tsx +1 -1
  67. package/src/payment/skeleton/payment.tsx +1 -1
  68. package/src/payment/summary.tsx +2 -2
  69. package/src/theme/index.tsx +3 -1
  70. package/src/theme/typography.ts +8 -8
@@ -13,7 +13,6 @@ var _omit = _interopRequireDefault(require("lodash/omit"));
13
13
  var _unionBy = _interopRequireDefault(require("lodash/unionBy"));
14
14
  var _react = require("react");
15
15
  var _iconsMaterial = require("@mui/icons-material");
16
- var _tx = _interopRequireDefault(require("../components/blockchain/tx"));
17
16
  var _api = _interopRequireDefault(require("../libs/api"));
18
17
  var _util = require("../libs/util");
19
18
  var _form = _interopRequireDefault(require("./form"));
@@ -54,55 +53,176 @@ const fetchSupporters = (target, livemode = true) => {
54
53
  const emojiFont = {
55
54
  fontFamily: 'Avenir, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"'
56
55
  };
57
- function SupporterAvatar({
56
+ function DonateDetails({
58
57
  supporters = [],
59
- totalAmount = "0",
60
58
  currency,
61
59
  method
62
60
  }) {
63
61
  const {
64
- t
62
+ locale
65
63
  } = (0, _context.useLocaleContext)();
64
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
65
+ sx: {
66
+ width: "100%",
67
+ minWidth: "256px",
68
+ maxWidth: "calc(100vw - 32px)",
69
+ maxHeight: "300px",
70
+ overflowX: "hidden",
71
+ overflowY: "auto",
72
+ margin: "0 auto"
73
+ },
74
+ children: supporters.map(x => /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
75
+ sx: {
76
+ padding: "6px",
77
+ "&:hover": {
78
+ backgroundColor: "var(--backgrounds-bg-highlight, #eff6ff)",
79
+ transition: "background-color 200ms linear",
80
+ cursor: "pointer"
81
+ },
82
+ borderBottom: "1px solid var(--stroke-border-base, #EFF1F5)",
83
+ display: "flex",
84
+ justifyContent: "space-between",
85
+ alignItems: "center"
86
+ },
87
+ onClick: () => {
88
+ const {
89
+ link,
90
+ text
91
+ } = (0, _util.getTxLink)(method, x.payment_details);
92
+ if (link && text) {
93
+ window.open(link, "_blank");
94
+ }
95
+ },
96
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
97
+ direction: "row",
98
+ alignItems: "center",
99
+ spacing: 0.5,
100
+ sx: {
101
+ flex: 3,
102
+ overflow: "hidden"
103
+ },
104
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
105
+ src: (0, _util.getCustomerAvatar)(x.customer?.did, x?.updated_at ? new Date(x.updated_at).toISOString() : "", 20),
106
+ alt: x.customer?.name,
107
+ variant: "circular",
108
+ sx: {
109
+ width: 20,
110
+ height: 20
111
+ },
112
+ onClick: e => {
113
+ e.stopPropagation();
114
+ if (x.customer?.did) {
115
+ window.open((0, _util.getUserProfileLink)(x.customer?.did, locale), "_blank");
116
+ }
117
+ }
118
+ }, x.id), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
119
+ sx: {
120
+ ml: "8px !important",
121
+ fontSize: "0.875rem",
122
+ fontWeight: "500",
123
+ overflow: "hidden",
124
+ whiteSpace: "nowrap",
125
+ textOverflow: "ellipsis"
126
+ },
127
+ onClick: e => {
128
+ e.stopPropagation();
129
+ if (x.customer?.did) {
130
+ window.open((0, _util.getUserProfileLink)(x.customer?.did, locale), "_blank");
131
+ }
132
+ },
133
+ children: x.customer?.name
134
+ })]
135
+ }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
136
+ direction: "row",
137
+ alignItems: "center",
138
+ justifyContent: "flex-end",
139
+ spacing: 0.5,
140
+ sx: {
141
+ flex: 1
142
+ },
143
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
144
+ src: currency?.logo,
145
+ alt: currency?.symbol,
146
+ variant: "circular",
147
+ sx: {
148
+ width: 16,
149
+ height: 16
150
+ }
151
+ }, x.id), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
152
+ sx: {
153
+ color: "text.secondary"
154
+ },
155
+ children: (0, _util.formatBNStr)(x.amount_total, currency.decimal)
156
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
157
+ sx: {
158
+ color: "text.secondary"
159
+ },
160
+ children: currency.symbol
161
+ })]
162
+ })]
163
+ }, x.id))
164
+ });
165
+ }
166
+ function SupporterAvatar({
167
+ supporters = [],
168
+ totalAmount = "0",
169
+ currency,
170
+ method,
171
+ showDonateDetails = false
172
+ }) {
173
+ const [open, setOpen] = (0, _react.useState)(false);
66
174
  const customers = (0, _unionBy.default)(supporters, "customer_did");
67
175
  const customersNum = customers.length;
68
- return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
69
- display: "flex",
70
- flexDirection: "column",
176
+ if (customersNum === 0) return null;
177
+ return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
178
+ flexDirection: "row",
179
+ justifyContent: "center",
71
180
  alignItems: "center",
72
- sx: {
73
- ".MuiAvatar-root": {
74
- width: "32px",
75
- height: "32px"
76
- }
77
- },
78
- gap: {
79
- xs: 0.5,
80
- sm: 1
81
- },
82
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
83
- component: "p",
84
- color: "text.secondary",
85
- children: customersNum === 0 ? /* @__PURE__ */(0, _jsxRuntime.jsx)("span", {
86
- style: emojiFont,
87
- children: t("payment.checkout.donation.empty")
88
- }) : t("payment.checkout.donation.summary", {
89
- total: customersNum,
90
- symbol: currency.symbol,
91
- totalAmount: (0, _util.formatAmount)(totalAmount || "0", currency.decimal)
92
- })
93
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.AvatarGroup, {
94
- total: customersNum,
95
- max: 20,
96
- children: customers.map(x => /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
97
- title: x.customer?.name,
98
- alt: x.customer?.name,
99
- src: (0, _util.getCustomerAvatar)(x.customer?.did, x?.updated_at ? new Date(x.updated_at).toISOString() : "", 48),
100
- variant: "circular",
181
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.AvatarGroup, {
182
+ max: 5,
183
+ children: customers.slice(0, 5).map(supporter => /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
184
+ src: (0, _util.getCustomerAvatar)(supporter.customer?.did, supporter?.updated_at ? new Date(supporter.updated_at).toISOString() : "", 24),
185
+ alt: supporter.customer?.name,
101
186
  sx: {
102
- width: 32,
103
- height: 32
187
+ width: "24px",
188
+ height: "24px"
104
189
  }
105
- }, x.id))
190
+ }, supporter.customer?.id))
191
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
192
+ sx: {
193
+ fontSize: "14px",
194
+ color: "text.secondary",
195
+ pl: 1.5,
196
+ pr: 1,
197
+ ml: -1,
198
+ borderRadius: "8px",
199
+ backgroundColor: "#f4f4f5",
200
+ height: "24px",
201
+ ...(showDonateDetails ? {
202
+ cursor: "pointer",
203
+ "&:hover": {
204
+ backgroundColor: "#e5e7eb"
205
+ }
206
+ } : {})
207
+ },
208
+ onClick: () => showDonateDetails && setOpen(true),
209
+ children: `${customersNum} supporter${customersNum > 1 ? "s" : ""} (${(0, _util.formatAmount)(totalAmount || "0", currency?.decimal)} ${currency.symbol})`
210
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_Dialog.default, {
211
+ open,
212
+ onClose: () => setOpen(false),
213
+ sx: {
214
+ ".MuiDialogContent-root": {
215
+ width: "450px",
216
+ padding: "8px"
217
+ }
218
+ },
219
+ title: `${customersNum} supporter${customersNum > 1 ? "s" : ""}`,
220
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(DonateDetails, {
221
+ supporters,
222
+ currency,
223
+ method,
224
+ totalAmount
225
+ })
106
226
  })]
107
227
  });
108
228
  }
@@ -112,11 +232,9 @@ function SupporterTable({
112
232
  currency,
113
233
  method
114
234
  }) {
115
- const {
116
- t
117
- } = (0, _context.useLocaleContext)();
118
235
  const customers = (0, _unionBy.default)(supporters, "customer_did");
119
236
  const customersNum = customers.length;
237
+ if (customersNum === 0) return null;
120
238
  return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
121
239
  display: "flex",
122
240
  flexDirection: "column",
@@ -125,90 +243,16 @@ function SupporterTable({
125
243
  xs: 0.5,
126
244
  sm: 1
127
245
  },
128
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
129
- component: "p",
130
- color: "text.secondary",
131
- children: customersNum === 0 ? /* @__PURE__ */(0, _jsxRuntime.jsx)("span", {
132
- style: emojiFont,
133
- children: t("payment.checkout.donation.empty")
134
- }) : t("payment.checkout.donation.summary", {
135
- total: customersNum,
136
- symbol: currency.symbol,
137
- totalAmount: (0, _util.formatAmount)(totalAmount || "0", currency.decimal)
138
- })
139
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Table, {
140
- size: "small",
141
- sx: {
142
- width: "100%",
143
- overflow: "hidden"
144
- },
145
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.TableBody, {
146
- children: supporters.map(x => /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.TableRow, {
147
- sx: {
148
- "> td": {
149
- padding: "8px 16px 8px 0",
150
- borderTop: "1px solid #e0e0e0",
151
- borderBottom: "1px solid #e0e0e0"
152
- },
153
- "> td:last-of-type": {
154
- paddingRight: "0"
155
- }
156
- },
157
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.TableCell, {
158
- children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
159
- direction: "row",
160
- alignItems: "center",
161
- spacing: 0.5,
162
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
163
- src: (0, _util.getCustomerAvatar)(x.customer?.did, x?.updated_at ? new Date(x.updated_at).toISOString() : "", 48),
164
- alt: x.customer?.name,
165
- variant: "circular",
166
- sx: {
167
- width: 24,
168
- height: 24
169
- }
170
- }, x.id), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Hidden, {
171
- smDown: true,
172
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
173
- children: x.customer?.name
174
- })
175
- })]
176
- })
177
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.TableCell, {
178
- align: "right",
179
- children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
180
- direction: "row",
181
- alignItems: "center",
182
- justifyContent: "flex-end",
183
- spacing: 0.5,
184
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
185
- fontWeight: 500,
186
- component: "strong",
187
- children: (0, _util.formatBNStr)(x.amount_total, currency.decimal)
188
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
189
- component: "span",
190
- children: currency.symbol
191
- })]
192
- })
193
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Hidden, {
194
- smDown: true,
195
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.TableCell, {
196
- align: "right",
197
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
198
- children: (0, _util.formatDateTime)(x.created_at)
199
- })
200
- })
201
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.TableCell, {
202
- align: "right",
203
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_tx.default, {
204
- method,
205
- details: x.payment_details,
206
- mode: "customer",
207
- align: "right"
208
- })
209
- })]
210
- }, x.id))
211
- })
246
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(SupporterAvatar, {
247
+ supporters,
248
+ totalAmount,
249
+ currency,
250
+ method
251
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(DonateDetails, {
252
+ supporters,
253
+ totalAmount,
254
+ currency,
255
+ method
212
256
  })]
213
257
  });
214
258
  }
@@ -385,10 +429,7 @@ function CheckoutDonateInner({
385
429
  }, timeout);
386
430
  };
387
431
  if (donation.error) {
388
- return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Alert, {
389
- severity: "error",
390
- children: (0, _util.formatError)(donation.error)
391
- });
432
+ return null;
392
433
  }
393
434
  const handlePopoverOpen = event => {
394
435
  donation.run();
@@ -496,19 +537,39 @@ function CheckoutDonateInner({
496
537
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
497
538
  size: donateSettings.appearance?.button?.size || "medium",
498
539
  color: donateSettings.appearance?.button?.color || "primary",
499
- variant: donateSettings.appearance?.button?.variant || "contained",
540
+ variant: donateSettings.appearance?.button?.variant || "outlined",
541
+ sx: {
542
+ ...(!donateSettings.appearance?.button?.variant ? {
543
+ color: "var(--foregrounds-fg-base, #010714)",
544
+ borderColor: "var(--stroke-button-secondary-border, #E5E7EB)",
545
+ "&:hover": {
546
+ backgroundColor: "var(--buttons-button-neutral-hover, #F3F4F6)",
547
+ borderColor: "var(--stroke-button-secondary-border, #E5E7EB)"
548
+ }
549
+ } : {}),
550
+ // @ts-ignore
551
+ ...(donateSettings.appearance?.button?.sx || {})
552
+ },
500
553
  ...donateSettings.appearance?.button,
501
554
  onClick: () => startDonate(),
502
555
  children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
503
556
  direction: "row",
504
557
  alignItems: "center",
505
558
  spacing: 0.5,
506
- children: [donateSettings.appearance.button.icon, typeof donateSettings.appearance.button.text === "string" ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
559
+ children: [donateSettings.appearance.button.icon && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
560
+ sx: {
561
+ mr: 0.5,
562
+ display: "inline-flex",
563
+ alignItems: "center"
564
+ },
565
+ children: donateSettings.appearance.button.icon
566
+ }), typeof donateSettings.appearance.button.text === "string" ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
507
567
  children: donateSettings.appearance.button.text
508
568
  }) : donateSettings.appearance.button.text]
509
569
  })
510
570
  }), supporters.data && donateSettings.appearance.history.variant === "avatar" && /* @__PURE__ */(0, _jsxRuntime.jsx)(SupporterAvatar, {
511
- ...supporters.data
571
+ ...supporters.data,
572
+ showDonateDetails: true
512
573
  }), supporters.data && donateSettings.appearance.history.variant === "table" && /* @__PURE__ */(0, _jsxRuntime.jsx)(SupporterTable, {
513
574
  ...supporters.data
514
575
  })]
@@ -519,10 +580,10 @@ function CheckoutDonateInner({
519
580
  }
520
581
  if (mode === "custom") {
521
582
  return children && typeof children === "function" ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
522
- children: children(startDonate, `${(0, _util.formatAmount)(supporters.data?.totalAmount || "0", supporters.data?.currency?.decimal)} ${supporters.data?.currency?.symbol}`, supporters.data || {}, !!supporters.loading, donateSettings)
583
+ children: children(startDonate, `${(0, _util.formatAmount)(supporters.data?.totalAmount || "0", supporters.data?.currency?.decimal)} ${supporters.data?.currency?.symbol || ""}`, supporters.data || {}, !!supporters.loading, donateSettings)
523
584
  }) : /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
524
- children: ["Please provide a valid render function ", /* @__PURE__ */(0, _jsxRuntime.jsx)("pre", {
525
- children: "(openDonate, donateTotalAmount, supporters) => ReactNode"
585
+ children: ["Please provide a valid render function", " ", /* @__PURE__ */(0, _jsxRuntime.jsx)("pre", {
586
+ children: "(openDonate, donateTotalAmount, supporters, loading, donateSettings) => ReactNode"
526
587
  })]
527
588
  });
528
589
  }
@@ -24,7 +24,7 @@ function Livemode({
24
24
  height: 18,
25
25
  lineHeight: 1.2,
26
26
  textTransform: "uppercase",
27
- fontSize: "0.8rem",
27
+ fontSize: "0.7rem",
28
28
  fontWeight: "bold",
29
29
  borderRadius: "4px",
30
30
  backgroundColor,
@@ -0,0 +1,10 @@
1
+ import { type ButtonProps, type CircularProgressProps } from '@mui/material';
2
+ export interface LoadingButtonProps extends ButtonProps {
3
+ loading?: boolean;
4
+ loadingIndicator?: React.ReactNode;
5
+ loadingPosition?: 'start' | 'center' | 'end';
6
+ loadingProps?: Partial<CircularProgressProps>;
7
+ loadingOnly?: boolean;
8
+ }
9
+ declare const LoadingButton: import("react").ForwardRefExoticComponent<Omit<LoadingButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
10
+ export default LoadingButton;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ var _material = require("@mui/material");
9
+ var _react = require("react");
10
+ const LoadingButton = (0, _react.forwardRef)(({
11
+ children,
12
+ loading,
13
+ loadingPosition = "start",
14
+ loadingIndicator,
15
+ loadingProps = {},
16
+ onClick,
17
+ sx,
18
+ loadingOnly = false,
19
+ ...props
20
+ }, ref) => {
21
+ const handleClick = e => {
22
+ if (loading) {
23
+ return;
24
+ }
25
+ onClick?.(e);
26
+ };
27
+ const getPositionStyles = position => {
28
+ return {
29
+ color: "inherit",
30
+ ...(position === "start" && {
31
+ mr: 1
32
+ }),
33
+ ...(position === "end" && {
34
+ ml: 1
35
+ }),
36
+ ...(position === "center" && {
37
+ position: "absolute",
38
+ left: "50%",
39
+ transform: "translateY(-50%) translateX(-50%)",
40
+ top: "50%"
41
+ }),
42
+ display: "inline-flex",
43
+ alignItems: "center"
44
+ };
45
+ };
46
+ const defaultIndicator = /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.CircularProgress, {
47
+ size: 16,
48
+ ...loadingProps,
49
+ sx: {
50
+ color: "inherit",
51
+ ...(loadingProps?.sx || {})
52
+ }
53
+ });
54
+ const indicator = /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
55
+ sx: getPositionStyles(loadingPosition),
56
+ children: loadingIndicator || defaultIndicator
57
+ });
58
+ return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Button, {
59
+ ref,
60
+ disabled: props.disabled,
61
+ onClick: handleClick,
62
+ sx: {
63
+ position: "relative",
64
+ display: "inline-flex",
65
+ alignItems: "center",
66
+ justifyContent: "center",
67
+ ...sx
68
+ },
69
+ ...props,
70
+ children: [loading && loadingPosition === "start" && indicator, /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
71
+ sx: {
72
+ visibility: loading && loadingOnly ? "hidden" : "visible"
73
+ },
74
+ children
75
+ }), loading && loadingPosition === "center" && indicator, loading && loadingPosition === "end" && indicator]
76
+ });
77
+ });
78
+ LoadingButton.displayName = "LoadingButton";
79
+ LoadingButton.defaultProps = {
80
+ loading: false,
81
+ loadingIndicator: void 0,
82
+ loadingPosition: "start",
83
+ loadingProps: {},
84
+ loadingOnly: false
85
+ };
86
+ module.exports = LoadingButton;
@@ -8,7 +8,6 @@ var _jsxRuntime = require("react/jsx-runtime");
8
8
  var _context = require("@arcblock/ux/lib/Locale/context");
9
9
  var _Toast = _interopRequireDefault(require("@arcblock/ux/lib/Toast"));
10
10
  var _iconsMaterial = require("@mui/icons-material");
11
- var _lab = require("@mui/lab");
12
11
  var _material = require("@mui/material");
13
12
  var _system = require("@mui/system");
14
13
  var _ahooks = require("ahooks");
@@ -19,6 +18,7 @@ var _payment = require("../contexts/payment");
19
18
  var _util2 = require("../libs/util");
20
19
  var _mobile = require("../hooks/mobile");
21
20
  var _truncatedText = _interopRequireDefault(require("./truncated-text"));
21
+ var _loadingButton = _interopRequireDefault(require("./loading-button"));
22
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
23
  const sortOrder = {
24
24
  year: 1,
@@ -314,7 +314,6 @@ function PricingTable({
314
314
  justifyContent: alignItems === "center" ? "center" : "flex-start",
315
315
  sx: {
316
316
  flex: "0 1 auto",
317
- overflow: "auto",
318
317
  pb: 2.5
319
318
  },
320
319
  className: "price-table-wrap",
@@ -341,7 +340,7 @@ function PricingTable({
341
340
  boxShadow: "0px 0px 0px 1px rgba(3, 7, 18, 0.08), 0px 1px 2px -1px rgba(3, 7, 18, 0.08), 0px 2px 4px rgba(3, 7, 18, 0.04)",
342
341
  "&:hover": {
343
342
  borderColor: mode === "select" && x.is_selected ? "primary.main" : "#ddd",
344
- boxShadow: "0 8px 16px rgba(0, 0, 0, 20%)"
343
+ boxShadow: "0px 0px 0px 1px var(--shadows-card-hover-1, rgba(2, 7, 19, 0.08)),0px 1px 2px -1px var(--shadows-card-hover-2, rgba(2, 7, 19, 0.08)),0px 2px 8px 0px var(--shadows-card-hover-3, rgba(2, 7, 19, 0.10))"
345
344
  },
346
345
  width: {
347
346
  xs: "100%",
@@ -510,7 +509,7 @@ function Subscribe({
510
509
  _Toast.default.error((0, _util2.formatError)(err));
511
510
  }
512
511
  };
513
- return /* @__PURE__ */(0, _jsxRuntime.jsx)(_lab.LoadingButton, {
512
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_loadingButton.default, {
514
513
  fullWidth: true,
515
514
  size: "medium",
516
515
  variant: "contained",
@@ -72,7 +72,7 @@ const Table = _react.default.memo(({
72
72
  });
73
73
  const Wrapped = (0, _system.styled)(_Datatable.default)`
74
74
  ${props => props?.hasRowLink ? `.MuiTableCell-root {
75
- font-size: 1rem !important;
75
+ font-size: 0.875rem !important;
76
76
  }` : ""}
77
77
  .MuiPaper-root {
78
78
  border-radius: 8px;
package/lib/index.d.ts CHANGED
@@ -30,6 +30,7 @@ import Link from './components/link';
30
30
  import { createLazyComponent } from './components/lazy-loader';
31
31
  import OverdueInvoicePayment from './components/over-due-invoice-payment';
32
32
  import PaymentBeneficiaries from './components/payment-beneficiaries';
33
+ import LoadingButton from './components/loading-button';
33
34
  export { PaymentThemeProvider } from './theme';
34
35
  export * from './libs/util';
35
36
  export * from './libs/connect';
@@ -42,4 +43,4 @@ export * from './hooks/mobile';
42
43
  export * from './hooks/table';
43
44
  export * from './hooks/scroll';
44
45
  export { translations, createTranslator } from './locales';
45
- export { createLazyComponent, api, dayjs, FormInput, PhoneInput, AddressForm, StripeForm, Status, Livemode, Switch, ConfirmDialog, CheckoutForm, CheckoutTable, CheckoutDonate, CurrencySelector, Payment, PaymentSummary, PricingTable, ProductSkeleton, Amount, CustomerInvoiceList, CustomerPaymentList, TxLink, TxGas, SafeGuard, PricingItem, CountrySelect, Table, TruncatedText, Link, OverdueInvoicePayment, PaymentBeneficiaries, };
46
+ export { createLazyComponent, api, dayjs, FormInput, PhoneInput, AddressForm, StripeForm, Status, Livemode, Switch, ConfirmDialog, CheckoutForm, CheckoutTable, CheckoutDonate, CurrencySelector, Payment, PaymentSummary, PricingTable, ProductSkeleton, Amount, CustomerInvoiceList, CustomerPaymentList, TxLink, TxGas, SafeGuard, PricingItem, CountrySelect, Table, TruncatedText, Link, OverdueInvoicePayment, PaymentBeneficiaries, LoadingButton, };
package/lib/index.js CHANGED
@@ -36,6 +36,7 @@ var _exportNames = {
36
36
  createLazyComponent: true,
37
37
  OverdueInvoicePayment: true,
38
38
  PaymentBeneficiaries: true,
39
+ LoadingButton: true,
39
40
  PaymentThemeProvider: true,
40
41
  translations: true,
41
42
  createTranslator: true
@@ -118,6 +119,12 @@ Object.defineProperty(exports, "Livemode", {
118
119
  return _livemode.default;
119
120
  }
120
121
  });
122
+ Object.defineProperty(exports, "LoadingButton", {
123
+ enumerable: true,
124
+ get: function () {
125
+ return _loadingButton.default;
126
+ }
127
+ });
121
128
  Object.defineProperty(exports, "OverdueInvoicePayment", {
122
129
  enumerable: true,
123
130
  get: function () {
@@ -282,6 +289,7 @@ var _link = _interopRequireDefault(require("./components/link"));
282
289
  var _lazyLoader = require("./components/lazy-loader");
283
290
  var _overDueInvoicePayment = _interopRequireDefault(require("./components/over-due-invoice-payment"));
284
291
  var _paymentBeneficiaries = _interopRequireDefault(require("./components/payment-beneficiaries"));
292
+ var _loadingButton = _interopRequireDefault(require("./components/loading-button"));
285
293
  var _theme = require("./theme");
286
294
  var _util = require("./libs/util");
287
295
  Object.keys(_util).forEach(function (key) {
@@ -113,3 +113,4 @@ export declare function getInvoiceDescriptionAndReason(invoice: TInvoiceExpanded
113
113
  };
114
114
  export declare function getPaymentKitComponent(): any;
115
115
  export declare function openDonationSettings(openInNewTab?: boolean): void;
116
+ export declare function getUserProfileLink(userDid: string, locale?: string): string;
package/lib/libs/util.js CHANGED
@@ -45,6 +45,7 @@ exports.getStatementDescriptor = getStatementDescriptor;
45
45
  exports.getSubscriptionAction = void 0;
46
46
  exports.getSubscriptionStatusColor = getSubscriptionStatusColor;
47
47
  exports.getTxLink = exports.getSubscriptionTimeSummary = void 0;
48
+ exports.getUserProfileLink = getUserProfileLink;
48
49
  exports.getWebhookStatusColor = getWebhookStatusColor;
49
50
  exports.getWordBreakStyle = getWordBreakStyle;
50
51
  exports.hasDelegateTxHash = hasDelegateTxHash;
@@ -1109,4 +1110,10 @@ function openDonationSettings(openInNewTab = false) {
1109
1110
  const mountPoint = paymentKit.mountPoint.endsWith("/") ? paymentKit.mountPoint.slice(0, -1) : paymentKit.mountPoint;
1110
1111
  window.open(`${window.location.origin}${mountPoint}/integrations/donations`, openInNewTab ? "_blank" : "_self");
1111
1112
  }
1113
+ }
1114
+ function getUserProfileLink(userDid, locale = "en") {
1115
+ return (0, _ufo.joinURL)(window.location.origin, (0, _ufo.withQuery)(".well-known/service/user", {
1116
+ locale,
1117
+ did: userDid
1118
+ }));
1112
1119
  }
@@ -15,7 +15,7 @@ function PaymentAmount({
15
15
  sx: {
16
16
  my: 0.5,
17
17
  fontWeight: 600,
18
- fontSize: "2.5rem",
18
+ fontSize: "2.1875rem",
19
19
  letterSpacing: "-0.03rem",
20
20
  fontVariantNumeric: "tabular-nums",
21
21
  ...sx