payment-kit 1.18.56 → 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 (129) hide show
  1. package/.eslintrc.js +6 -0
  2. package/blocklet.yml +1 -1
  3. package/package.json +57 -58
  4. package/src/components/actions.tsx +22 -9
  5. package/src/components/balance-list.tsx +40 -12
  6. package/src/components/collapse.tsx +22 -14
  7. package/src/components/copyable.tsx +8 -7
  8. package/src/components/currency.tsx +15 -7
  9. package/src/components/customer/actions.tsx +1 -5
  10. package/src/components/customer/form.tsx +3 -1
  11. package/src/components/customer/link.tsx +4 -12
  12. package/src/components/customer/notification-preference.tsx +18 -9
  13. package/src/components/customer/overdraft-protection.tsx +112 -41
  14. package/src/components/drawer-form.tsx +42 -18
  15. package/src/components/error.tsx +1 -5
  16. package/src/components/event/list.tsx +9 -10
  17. package/src/components/filter-toolbar.tsx +20 -19
  18. package/src/components/info-card.tsx +32 -18
  19. package/src/components/info-metric.tsx +16 -6
  20. package/src/components/info-row-group.tsx +1 -7
  21. package/src/components/info-row.tsx +30 -24
  22. package/src/components/invoice/action.tsx +1 -7
  23. package/src/components/invoice/list.tsx +15 -25
  24. package/src/components/invoice/recharge.tsx +5 -7
  25. package/src/components/invoice/table.tsx +17 -12
  26. package/src/components/layout/user.tsx +1 -1
  27. package/src/components/metadata/form.tsx +13 -13
  28. package/src/components/metadata/list.tsx +11 -3
  29. package/src/components/passport/actions.tsx +9 -4
  30. package/src/components/payment-currency/add.tsx +16 -3
  31. package/src/components/payment-currency/form.tsx +12 -6
  32. package/src/components/payment-intent/actions.tsx +24 -16
  33. package/src/components/payment-intent/list.tsx +11 -8
  34. package/src/components/payment-link/actions.tsx +1 -5
  35. package/src/components/payment-link/after-pay.tsx +4 -2
  36. package/src/components/payment-link/before-pay.tsx +14 -4
  37. package/src/components/payment-link/item.tsx +27 -6
  38. package/src/components/payment-link/preview.tsx +9 -9
  39. package/src/components/payment-link/product-select.tsx +17 -3
  40. package/src/components/payment-method/arcblock.tsx +6 -1
  41. package/src/components/payment-method/base.tsx +6 -1
  42. package/src/components/payment-method/bitcoin.tsx +6 -1
  43. package/src/components/payment-method/ethereum.tsx +6 -1
  44. package/src/components/payment-method/evm-rpc-input.tsx +11 -7
  45. package/src/components/payment-method/form.tsx +2 -7
  46. package/src/components/payouts/actions.tsx +1 -5
  47. package/src/components/payouts/list.tsx +11 -9
  48. package/src/components/payouts/portal/list.tsx +11 -9
  49. package/src/components/price/currency-select.tsx +28 -17
  50. package/src/components/price/form.tsx +135 -84
  51. package/src/components/price/upsell-select.tsx +10 -2
  52. package/src/components/price/upsell.tsx +7 -2
  53. package/src/components/pricing-table/actions.tsx +1 -5
  54. package/src/components/pricing-table/customer-settings.tsx +5 -1
  55. package/src/components/pricing-table/payment-settings.tsx +14 -4
  56. package/src/components/pricing-table/preview.tsx +9 -9
  57. package/src/components/pricing-table/price-item.tsx +6 -1
  58. package/src/components/pricing-table/product-item.tsx +6 -1
  59. package/src/components/pricing-table/product-settings.tsx +17 -4
  60. package/src/components/product/actions.tsx +1 -5
  61. package/src/components/product/create.tsx +1 -5
  62. package/src/components/product/cross-sell-select.tsx +5 -1
  63. package/src/components/product/cross-sell.tsx +7 -2
  64. package/src/components/product/features.tsx +13 -3
  65. package/src/components/product/form.tsx +38 -10
  66. package/src/components/progress-bar.tsx +1 -1
  67. package/src/components/refund/actions.tsx +1 -7
  68. package/src/components/refund/list.tsx +12 -17
  69. package/src/components/section/header.tsx +23 -12
  70. package/src/components/subscription/actions/cancel.tsx +22 -5
  71. package/src/components/subscription/actions/index.tsx +9 -10
  72. package/src/components/subscription/actions/pause.tsx +32 -6
  73. package/src/components/subscription/actions/slash-stake.tsx +5 -3
  74. package/src/components/subscription/description.tsx +12 -8
  75. package/src/components/subscription/items/index.tsx +30 -15
  76. package/src/components/subscription/items/usage-records.tsx +19 -5
  77. package/src/components/subscription/list.tsx +5 -7
  78. package/src/components/subscription/metrics.tsx +27 -12
  79. package/src/components/subscription/portal/actions.tsx +76 -70
  80. package/src/components/subscription/portal/cancel.tsx +10 -3
  81. package/src/components/subscription/portal/list.tsx +48 -26
  82. package/src/components/uploader.tsx +5 -13
  83. package/src/components/webhook/attempts.tsx +51 -16
  84. package/src/components/webhook/request-info.tsx +8 -6
  85. package/src/contexts/products.tsx +1 -1
  86. package/src/pages/admin/billing/invoices/detail.tsx +48 -12
  87. package/src/pages/admin/billing/subscriptions/detail.tsx +43 -11
  88. package/src/pages/admin/customers/customers/detail.tsx +53 -12
  89. package/src/pages/admin/customers/customers/index.tsx +6 -1
  90. package/src/pages/admin/developers/events/detail.tsx +36 -10
  91. package/src/pages/admin/developers/webhooks/detail.tsx +41 -11
  92. package/src/pages/admin/index.tsx +15 -2
  93. package/src/pages/admin/overview.tsx +107 -19
  94. package/src/pages/admin/payments/intents/detail.tsx +57 -13
  95. package/src/pages/admin/payments/payouts/detail.tsx +62 -14
  96. package/src/pages/admin/payments/refunds/detail.tsx +57 -13
  97. package/src/pages/admin/products/index.tsx +8 -2
  98. package/src/pages/admin/products/links/create.tsx +22 -4
  99. package/src/pages/admin/products/links/detail.tsx +42 -13
  100. package/src/pages/admin/products/passports/index.tsx +23 -4
  101. package/src/pages/admin/products/prices/actions.tsx +1 -6
  102. package/src/pages/admin/products/prices/detail.tsx +43 -11
  103. package/src/pages/admin/products/prices/list.tsx +7 -2
  104. package/src/pages/admin/products/pricing-tables/create.tsx +45 -12
  105. package/src/pages/admin/products/pricing-tables/detail.tsx +44 -13
  106. package/src/pages/admin/products/products/create.tsx +4 -1
  107. package/src/pages/admin/products/products/detail.tsx +72 -17
  108. package/src/pages/admin/settings/index.tsx +8 -1
  109. package/src/pages/admin/settings/payment-methods/index.tsx +84 -19
  110. package/src/pages/admin/settings/vault-config/edit-form.tsx +42 -28
  111. package/src/pages/admin/settings/vault-config/index.tsx +57 -10
  112. package/src/pages/customer/index.tsx +41 -15
  113. package/src/pages/customer/invoice/detail.tsx +63 -14
  114. package/src/pages/customer/invoice/past-due.tsx +11 -3
  115. package/src/pages/customer/payout/detail.tsx +56 -13
  116. package/src/pages/customer/recharge/account.tsx +80 -20
  117. package/src/pages/customer/recharge/subscription.tsx +86 -25
  118. package/src/pages/customer/refund/list.tsx +60 -24
  119. package/src/pages/customer/subscription/change-payment.tsx +13 -4
  120. package/src/pages/customer/subscription/change-plan.tsx +34 -7
  121. package/src/pages/customer/subscription/detail.tsx +86 -20
  122. package/src/pages/customer/subscription/embed.tsx +24 -4
  123. package/src/pages/home.tsx +26 -4
  124. package/src/pages/integrations/donations/edit-form.tsx +25 -9
  125. package/src/pages/integrations/donations/index.tsx +26 -9
  126. package/src/pages/integrations/donations/preview.tsx +59 -15
  127. package/src/pages/integrations/index.tsx +10 -1
  128. package/src/pages/integrations/overview.tsx +78 -17
  129. package/vite.config.ts +60 -30
package/.eslintrc.js CHANGED
@@ -14,5 +14,11 @@ module.exports = {
14
14
  'react-hooks/exhaustive-deps': 'off',
15
15
  'jsx-a11y/no-noninteractive-element-interactions': 'off',
16
16
  '@typescript-eslint/indent': 'off',
17
+ 'react/require-default-props': [
18
+ 'error',
19
+ {
20
+ functions: 'defaultArguments',
21
+ },
22
+ ],
17
23
  },
18
24
  };
package/blocklet.yml CHANGED
@@ -14,7 +14,7 @@ repository:
14
14
  type: git
15
15
  url: git+https://github.com/blocklet/payment-kit.git
16
16
  specVersion: 1.2.8
17
- version: 1.18.56
17
+ version: 1.19.0
18
18
  logo: logo.png
19
19
  files:
20
20
  - dist
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "payment-kit",
3
- "version": "1.18.56",
3
+ "version": "1.19.0",
4
4
  "scripts": {
5
5
  "dev": "blocklet dev --open",
6
- "eject": "vite eject",
7
6
  "lint": "tsc --noEmit && eslint src api/src --ext .mjs,.js,.jsx,.ts,.tsx",
8
7
  "lint:fix": "pnpm run lint --fix",
9
8
  "format": "prettier -w src",
@@ -47,116 +46,116 @@
47
46
  "@abtnode/cron": "^1.16.44",
48
47
  "@arcblock/did": "^1.20.14",
49
48
  "@arcblock/did-auth-storage-nedb": "^1.7.1",
50
- "@arcblock/did-connect": "^2.13.66",
49
+ "@arcblock/did-connect": "^3.0.1",
51
50
  "@arcblock/did-util": "^1.20.14",
52
51
  "@arcblock/jwt": "^1.20.14",
53
- "@arcblock/ux": "^2.13.66",
52
+ "@arcblock/ux": "^3.0.1",
54
53
  "@arcblock/validator": "^1.20.14",
55
- "@blocklet/did-space-js": "^1.0.60",
54
+ "@blocklet/did-space-js": "^1.0.62",
56
55
  "@blocklet/js-sdk": "^1.16.44",
57
56
  "@blocklet/logger": "^1.16.44",
58
- "@blocklet/payment-react": "1.18.56",
57
+ "@blocklet/payment-react": "1.19.0",
59
58
  "@blocklet/sdk": "^1.16.44",
60
- "@blocklet/ui-react": "^2.13.66",
61
- "@blocklet/uploader": "^0.1.95",
59
+ "@blocklet/ui-react": "^3.0.1",
60
+ "@blocklet/uploader": "^0.1.97",
62
61
  "@blocklet/xss": "^0.1.36",
63
- "@mui/icons-material": "^5.16.6",
64
- "@mui/lab": "^5.0.0-alpha.173",
65
- "@mui/material": "^5.16.6",
66
- "@mui/system": "^5.16.6",
62
+ "@mui/icons-material": "^7.1.2",
63
+ "@mui/lab": "7.0.0-beta.14",
64
+ "@mui/material": "^7.1.2",
65
+ "@mui/system": "^7.1.1",
67
66
  "@ocap/asset": "^1.20.14",
68
67
  "@ocap/client": "^1.20.14",
69
68
  "@ocap/mcrypto": "^1.20.14",
70
69
  "@ocap/util": "^1.20.14",
71
70
  "@ocap/wallet": "^1.20.14",
72
- "@stripe/react-stripe-js": "^2.7.3",
71
+ "@stripe/react-stripe-js": "^2.9.0",
73
72
  "@stripe/stripe-js": "^2.4.0",
74
- "ahooks": "^3.8.0",
75
- "axios": "^1.7.5",
76
- "body-parser": "^1.20.2",
73
+ "ahooks": "^3.8.5",
74
+ "axios": "^1.10.0",
75
+ "body-parser": "^1.20.3",
77
76
  "cls-hooked": "^4.2.2",
78
- "cookie-parser": "^1.4.6",
77
+ "cookie-parser": "^1.4.7",
79
78
  "copy-to-clipboard": "^3.3.3",
80
79
  "cors": "^2.8.5",
81
80
  "date-fns": "^3.6.0",
82
- "dayjs": "^1.11.12",
83
- "debug": "^4.3.6",
81
+ "dayjs": "^1.11.13",
82
+ "debug": "^4.4.1",
84
83
  "dotenv-flow": "^3.3.0",
85
- "ethers": "^6.13.5",
86
- "express": "^4.19.2",
84
+ "ethers": "^6.14.4",
85
+ "express": "^4.21.2",
87
86
  "express-async-errors": "^3.1.1",
88
87
  "express-history-api-fallback": "^2.2.1",
89
- "fastq": "^1.17.1",
88
+ "fastq": "^1.19.1",
90
89
  "flat": "^5.0.2",
91
- "google-libphonenumber": "^3.2.38",
90
+ "google-libphonenumber": "^3.2.42",
92
91
  "html2canvas": "^1.4.1",
93
92
  "iframe-resizer-react": "^1.1.1",
94
- "joi": "^17.12.2",
95
- "json-stable-stringify": "^1.1.1",
93
+ "joi": "17.12.2",
94
+ "json-stable-stringify": "^1.3.0",
96
95
  "jspdf": "^2.5.2",
97
96
  "lodash": "^4.17.21",
98
97
  "morgan": "^1.10.0",
99
98
  "mui-daterange-picker": "^1.0.5",
100
- "nanoid": "3",
99
+ "nanoid": "^3.3.11",
101
100
  "p-all": "3.0.0",
102
- "p-wait-for": "3",
101
+ "p-wait-for": "^3.2.0",
103
102
  "pretty-ms-i18n": "^1.0.3",
104
- "react": "18.2.0",
105
- "react-dom": "18.2.0",
106
- "react-error-boundary": "^4.0.13",
107
- "react-hook-form": "^7.52.1",
103
+ "react": "^19.1.0",
104
+ "react-dom": "^19.1.0",
105
+ "react-error-boundary": "^4.1.2",
106
+ "react-hook-form": "^7.58.1",
108
107
  "react-international-phone": "^3.1.2",
109
- "react-router-dom": "^6.25.1",
110
- "recharts": "^2.12.7",
108
+ "react-router-dom": "^6.30.1",
109
+ "recharts": "^2.15.4",
111
110
  "rimraf": "^3.0.2",
112
- "sequelize": "^6.37.3",
111
+ "sequelize": "^6.37.7",
113
112
  "sql-where-parser": "^2.2.1",
114
113
  "sqlite3": "^5.1.7",
115
114
  "stripe": "^13.11.0",
116
- "typewriter-effect": "^2.21.0",
115
+ "typewriter-effect": "^2.22.0",
117
116
  "ufo": "^1.6.1",
118
- "umzug": "^3.8.1",
117
+ "umzug": "^3.8.2",
119
118
  "use-bus": "^2.5.2",
120
- "validator": "^13.12.0",
119
+ "validator": "^13.15.15",
121
120
  "web3": "^4.16.0"
122
121
  },
123
122
  "devDependencies": {
124
123
  "@abtnode/types": "^1.16.44",
125
124
  "@arcblock/eslint-config-ts": "^0.3.3",
126
- "@blocklet/payment-types": "1.18.56",
127
- "@types/cookie-parser": "^1.4.7",
128
- "@types/cors": "^2.8.17",
125
+ "@blocklet/payment-types": "1.19.0",
126
+ "@types/cookie-parser": "^1.4.9",
127
+ "@types/cors": "^2.8.19",
129
128
  "@types/debug": "^4.1.12",
130
129
  "@types/dotenv-flow": "^3.3.3",
131
- "@types/express": "^4.17.21",
132
- "@types/node": "^18.19.42",
133
- "@types/react": "^18.3.3",
134
- "@types/react-dom": "^18.3.0",
135
- "@vitejs/plugin-react": "^4.3.1",
130
+ "@types/express": "^4.17.23",
131
+ "@types/node": "^18.19.112",
132
+ "@types/react": "^18.3.23",
133
+ "@types/react-dom": "^18.3.7",
134
+ "@vitejs/plugin-react": "^4.6.0",
136
135
  "babel-plugin-lodash": "^3.3.4",
137
136
  "bumpp": "^8.2.1",
138
137
  "cross-env": "^7.0.3",
139
- "eslint": "^8.57.0",
138
+ "eslint": "^8.57.1",
140
139
  "import-sort-style-module": "^6.0.0",
141
140
  "jest": "^29.7.0",
142
141
  "lint-staged": "^12.5.0",
143
142
  "nodemon": "^2.0.22",
144
143
  "npm-run-all": "^4.1.5",
145
- "prettier": "^3.3.3",
144
+ "prettier": "^3.6.0",
146
145
  "prettier-plugin-import-sort": "^0.0.7",
147
- "rollup-plugin-visualizer": "^5.12.0",
148
- "ts-jest": "^29.2.5",
146
+ "rollup-plugin-visualizer": "^6.0.3",
147
+ "ts-jest": "^29.4.0",
149
148
  "ts-node": "^10.9.2",
150
- "tsx": "^4.19.2",
151
- "type-fest": "^4.23.0",
152
- "typescript": "^5.5.4",
153
- "vite": "^5.3.5",
154
- "vite-node": "^2.0.4",
149
+ "tsx": "^4.20.3",
150
+ "type-fest": "^4.41.0",
151
+ "typescript": "5.5.4",
152
+ "vite": "^7.0.0",
153
+ "vite-node": "^3.2.4",
155
154
  "vite-plugin-babel-import": "^2.0.5",
156
155
  "vite-plugin-blocklet": "^0.9.33",
157
- "vite-plugin-node-polyfills": "^0.21.0",
158
- "vite-plugin-svgr": "^4.2.0",
159
- "vite-tsconfig-paths": "^4.3.2",
156
+ "vite-plugin-node-polyfills": "^0.23.0",
157
+ "vite-plugin-svgr": "^4.3.0",
158
+ "vite-tsconfig-paths": "^5.1.4",
160
159
  "zx": "^7.2.3"
161
160
  },
162
161
  "importSort": {
@@ -169,5 +168,5 @@
169
168
  "parser": "typescript"
170
169
  }
171
170
  },
172
- "gitHead": "9fd0235186e07388337cf1a57b257f97de8dd4c3"
171
+ "gitHead": "2810263174bb900ebb5a431dc53930b08b4a8d6d"
173
172
  }
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react/prop-types */
1
2
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
2
3
  import { stopEvent } from '@blocklet/payment-react';
3
4
  import { ExpandMoreOutlined, MoreHorizOutlined } from '@mui/icons-material';
@@ -21,13 +22,15 @@ export type ActionsProps = {
21
22
  onOpenCallback?: Function;
22
23
  };
23
24
 
24
- Actions.defaultProps = {
25
- variant: 'compact',
26
- sx: {},
27
- onOpenCallback: null,
28
- };
29
-
30
- export default function Actions(props: ActionsProps) {
25
+ export default function Actions(rawProps: ActionsProps) {
26
+ const props: ActionsProps = Object.assign(
27
+ {
28
+ variant: 'compact',
29
+ sx: {},
30
+ onOpenCallback: null,
31
+ },
32
+ rawProps
33
+ );
31
34
  const { t } = useLocaleContext();
32
35
  const [anchorEl, setAnchorEl] = useState(null);
33
36
  const open = Boolean(anchorEl);
@@ -102,7 +105,12 @@ export default function Actions(props: ActionsProps) {
102
105
  {props.actions.map((action) =>
103
106
  openLoading ? (
104
107
  <MenuItem key={action.label} dense disabled>
105
- <ListItemText primary={<Skeleton />} primaryTypographyProps={{ width: '56px' }} />
108
+ <ListItemText
109
+ primary={<Skeleton />}
110
+ slotProps={{
111
+ primary: { width: '56px' },
112
+ }}
113
+ />
106
114
  </MenuItem>
107
115
  ) : (
108
116
  <MenuItem
@@ -111,7 +119,12 @@ export default function Actions(props: ActionsProps) {
111
119
  dense={!!action.dense}
112
120
  disabled={!!action.disabled}
113
121
  onClick={(e) => onClose(e, action.handler)}>
114
- <ListItemText primary={action.label} primaryTypographyProps={{ color: action.color }} />
122
+ <ListItemText
123
+ primary={action.label}
124
+ slotProps={{
125
+ primary: { color: action.color },
126
+ }}
127
+ />
115
128
  </MenuItem>
116
129
  )
117
130
  )}
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react/prop-types */
1
2
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
2
3
  import { formatBNStr, usePaymentContext } from '@blocklet/payment-react';
3
4
  import type { GroupedBN } from '@blocklet/payment-types';
@@ -10,17 +11,36 @@ type Props = {
10
11
  showLogo?: boolean;
11
12
  };
12
13
 
13
- export default function BalanceList(props: Props) {
14
+ export default function BalanceList(rawProps: Props) {
15
+ const props = Object.assign(
16
+ {
17
+ data: {},
18
+ showLogo: false,
19
+ },
20
+ rawProps
21
+ );
14
22
  const { t } = useLocaleContext();
15
23
  const { settings } = usePaymentContext();
16
24
  const currencies = flatten(settings.paymentMethods.map((method) => method.payment_currencies));
17
25
 
18
26
  if (isEmpty(props.data)) {
19
- return <Typography color="text.secondary">{t('common.none')}</Typography>;
27
+ return (
28
+ <Typography
29
+ sx={{
30
+ color: 'text.secondary',
31
+ }}>
32
+ {t('common.none')}
33
+ </Typography>
34
+ );
20
35
  }
21
36
 
22
37
  return (
23
- <Stack direction="column" alignItems="flex-start" sx={{ width: '100%' }}>
38
+ <Stack
39
+ direction="column"
40
+ sx={{
41
+ alignItems: 'flex-start',
42
+ width: '100%',
43
+ }}>
24
44
  {Object.entries(props.data).map(([currencyId, amount]) => {
25
45
  const currency = currencies.find((c) => c.id === currencyId);
26
46
  if (!currency) {
@@ -29,17 +49,30 @@ export default function BalanceList(props: Props) {
29
49
  return (
30
50
  <Stack
31
51
  key={currencyId}
32
- sx={{ width: '100%', maxWidth: '280px' }}
33
52
  direction="row"
34
53
  spacing={1}
35
- alignItems="center">
54
+ sx={{
55
+ alignItems: 'center',
56
+ width: '100%',
57
+ maxWidth: '280px',
58
+ }}>
36
59
  {props?.showLogo && (
37
60
  <Avatar src={currency.logo} alt={currency.symbol} style={{ width: '18px', height: '18px' }} />
38
61
  )}
39
- <Typography sx={{ width: '32px', minWidth: 100 }} color="text.secondary">
62
+ <Typography
63
+ sx={{
64
+ color: 'text.secondary',
65
+ width: '32px',
66
+ minWidth: 100,
67
+ }}>
40
68
  {currency.symbol}
41
69
  </Typography>
42
- <Typography sx={{ flex: 1, textAlign: 'right' }} color="text.primary">
70
+ <Typography
71
+ sx={{
72
+ color: 'text.primary',
73
+ flex: 1,
74
+ textAlign: 'right',
75
+ }}>
43
76
  {formatBNStr(amount, currency.decimal, 6, false)}
44
77
  </Typography>
45
78
  </Stack>
@@ -48,8 +81,3 @@ export default function BalanceList(props: Props) {
48
81
  </Stack>
49
82
  );
50
83
  }
51
-
52
- BalanceList.defaultProps = {
53
- data: {},
54
- showLogo: false,
55
- };
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react/prop-types */
1
2
  import { ExpandLessOutlined, ExpandMoreOutlined } from '@mui/icons-material';
2
3
  import { Box, Collapse, Stack } from '@mui/material';
3
4
  import { useEffect, useState } from 'react';
@@ -13,17 +14,19 @@ type Props = {
13
14
  lazy?: boolean;
14
15
  };
15
16
 
16
- IconCollapse.defaultProps = {
17
- value: '',
18
- onChange: () => {},
19
- children: null,
20
- expanded: false,
21
- addons: null,
22
- style: {},
23
- lazy: true,
24
- };
25
-
26
- export default function IconCollapse(props: Props) {
17
+ export default function IconCollapse(rawProps: Props) {
18
+ const props = Object.assign(
19
+ {
20
+ value: '',
21
+ onChange: () => {},
22
+ children: null,
23
+ expanded: false,
24
+ addons: null,
25
+ style: {},
26
+ lazy: true,
27
+ },
28
+ rawProps
29
+ );
27
30
  const [expanded, setExpanded] = useState(props.expanded || false);
28
31
  const toggleExpanded = () => {
29
32
  const newExpanded = !expanded;
@@ -38,14 +41,14 @@ export default function IconCollapse(props: Props) {
38
41
  <>
39
42
  <Stack
40
43
  direction="row"
41
- alignItems="center"
42
- justifyContent="space-between"
43
44
  onClick={(e) => {
44
45
  e.stopPropagation();
45
46
  props.onChange?.(props.value || '', !expanded);
46
47
  toggleExpanded();
47
48
  }}
48
49
  sx={{
50
+ alignItems: 'center',
51
+ justifyContent: 'space-between',
49
52
  width: 1,
50
53
  cursor: 'pointer',
51
54
  fontWeight: 500,
@@ -54,7 +57,12 @@ export default function IconCollapse(props: Props) {
54
57
  ...props.style,
55
58
  }}>
56
59
  <Box>{typeof props.trigger === 'function' ? props.trigger(expanded) : props.trigger}</Box>
57
- <Stack direction="row" alignItems="center" spacing={2}>
60
+ <Stack
61
+ direction="row"
62
+ spacing={2}
63
+ sx={{
64
+ alignItems: 'center',
65
+ }}>
58
66
  {props.addons} {expanded ? <ExpandLessOutlined /> : <ExpandMoreOutlined />}
59
67
  </Stack>
60
68
  </Stack>
@@ -9,7 +9,7 @@ interface CopyableProps {
9
9
  children?: ReactNode;
10
10
  style?: React.CSSProperties;
11
11
  }
12
- export default function Copyable({ text, children, style }: CopyableProps) {
12
+ export default function Copyable({ text, children = null, style = {} }: CopyableProps) {
13
13
  const { locale } = useLocaleContext();
14
14
  return (
15
15
  /* eslint-disable-next-line @typescript-eslint/ban-ts-comment */
@@ -20,7 +20,13 @@ export default function Copyable({ text, children, style }: CopyableProps) {
20
20
  locale={locale}
21
21
  style={style}
22
22
  render={({ copyButton, containerRef }: any) => (
23
- <Stack ref={containerRef} direction="row" alignItems="center" color="text.secondary">
23
+ <Stack
24
+ ref={containerRef}
25
+ direction="row"
26
+ sx={{
27
+ alignItems: 'center',
28
+ color: 'text.secondary',
29
+ }}>
24
30
  {children || (
25
31
  <Typography
26
32
  className="copyable-text"
@@ -41,8 +47,3 @@ export default function Copyable({ text, children, style }: CopyableProps) {
41
47
  />
42
48
  );
43
49
  }
44
-
45
- Copyable.defaultProps = {
46
- style: {},
47
- children: null,
48
- };
@@ -6,17 +6,25 @@ type Props = {
6
6
  sx?: SxProps;
7
7
  };
8
8
 
9
- export default function Currency({ logo, name, sx }: Props) {
9
+ export default function Currency({ logo, name, sx = {} }: Props) {
10
10
  return (
11
- <Stack direction="row" alignItems="center" spacing={0.5} sx={sx}>
11
+ <Stack
12
+ direction="row"
13
+ spacing={0.5}
14
+ sx={[
15
+ {
16
+ alignItems: 'center',
17
+ },
18
+ ...(Array.isArray(sx) ? sx : [sx]),
19
+ ]}>
12
20
  <Avatar src={logo} alt={name} sx={{ width: 20, height: 20 }} />
13
- <Typography color="text.primary" className="currency-name">
21
+ <Typography
22
+ className="currency-name"
23
+ sx={{
24
+ color: 'text.primary',
25
+ }}>
14
26
  {name}
15
27
  </Typography>
16
28
  </Stack>
17
29
  );
18
30
  }
19
-
20
- Currency.defaultProps = {
21
- sx: {},
22
- };
@@ -15,11 +15,7 @@ type Props = {
15
15
  variant?: LiteralUnion<'compact' | 'normal', string>;
16
16
  };
17
17
 
18
- CustomerActions.defaultProps = {
19
- variant: 'compact',
20
- };
21
-
22
- export default function CustomerActions({ data, onChange, variant }: Props) {
18
+ export default function CustomerActions({ data, onChange, variant = 'compact' }: Props) {
23
19
  const { t } = useLocaleContext();
24
20
  const [state, setState] = useSetState({
25
21
  action: '',
@@ -86,7 +86,9 @@ export default function CustomerForm() {
86
86
  <Controller
87
87
  name="address.country"
88
88
  control={control}
89
- render={({ field }) => <CountrySelect {...field} sx={{ pl: '6px' }} />}
89
+ render={({ field }) => (
90
+ <CountrySelect {...field} ref={field.ref as unknown as React.RefObject<HTMLDivElement>} sx={{ pl: '6px' }} />
91
+ )}
90
92
  />
91
93
  <FormInput
92
94
  name="address.state"
@@ -6,10 +6,10 @@ import { InfoType, UserCardProps } from '@arcblock/ux/lib/UserCard/types';
6
6
 
7
7
  export default function CustomerLink({
8
8
  customer,
9
- linked,
10
- linkTo,
11
- size,
12
- cardProps,
9
+ linked = true,
10
+ linkTo = '',
11
+ size = 'default',
12
+ cardProps = {},
13
13
  }: {
14
14
  customer: TCustomer;
15
15
  linked?: boolean;
@@ -61,11 +61,3 @@ export default function CustomerLink({
61
61
 
62
62
  return CustomerCard;
63
63
  }
64
-
65
- CustomerLink.defaultProps = {
66
- linked: true,
67
- linkTo: '',
68
- size: 'default',
69
- tooltip: true,
70
- cardProps: {},
71
- };
@@ -92,14 +92,10 @@ function TimeSelector({
92
92
  );
93
93
  }
94
94
 
95
- DaySelector.defaultProps = {
96
- onBlur: () => {},
97
- };
98
-
99
95
  function DaySelector({
100
96
  value,
101
97
  onChange,
102
- onBlur,
98
+ onBlur = () => {},
103
99
  }: {
104
100
  value: number;
105
101
  onChange: (day: number) => void;
@@ -275,7 +271,12 @@ export function NotificationPreferenceDialog({ open, onClose }: NotificationPref
275
271
  onClose={onClose}
276
272
  disableEscapeKeyDown
277
273
  title={
278
- <Stack direction="row" alignItems="center" spacing={1}>
274
+ <Stack
275
+ direction="row"
276
+ spacing={1}
277
+ sx={{
278
+ alignItems: 'center',
279
+ }}>
279
280
  <NotificationsOutlined fontSize="small" />
280
281
  <Typography variant="h6" component="span">
281
282
  {t('notification.preferences.title')}
@@ -301,7 +302,12 @@ export function NotificationPreferenceDialog({ open, onClose }: NotificationPref
301
302
  </Stack>
302
303
  }>
303
304
  {loading ? (
304
- <Stack alignItems="center" justifyContent="center" height={200}>
305
+ <Stack
306
+ sx={{
307
+ alignItems: 'center',
308
+ justifyContent: 'center',
309
+ height: 200,
310
+ }}>
305
311
  <CircularProgress />
306
312
  </Stack>
307
313
  ) : (
@@ -311,7 +317,10 @@ export function NotificationPreferenceDialog({ open, onClose }: NotificationPref
311
317
  <Typography id="frequency-label" sx={{ color: 'text.primary', mt: 2, mb: 1 }}>
312
318
  {t('notification.preferences.frequency.label')}
313
319
  </Typography>
314
- <Stack flexDirection="row">
320
+ <Stack
321
+ sx={{
322
+ flexDirection: 'row',
323
+ }}>
315
324
  <Box
316
325
  sx={{
317
326
  display: 'flex',
@@ -371,8 +380,8 @@ export function NotificationPreferenceDialog({ open, onClose }: NotificationPref
371
380
  {selectedDate > 28 && frequency === 'monthly' && (
372
381
  <Typography
373
382
  variant="caption"
374
- color="text.secondary"
375
383
  sx={{
384
+ color: 'text.secondary',
376
385
  fontStyle: 'italic',
377
386
  display: 'flex',
378
387
  alignItems: 'center',