@blocklet/payment-react 1.17.11 → 1.18.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.
@@ -83,6 +83,7 @@ function SupporterAvatar({ supporters = [], totalAmount = "0", currency, method
83
83
  Avatar,
84
84
  {
85
85
  title: x.customer?.name,
86
+ alt: x.customer?.name,
86
87
  src: getCustomerAvatar(x.customer?.did, x?.updated_at ? new Date(x.updated_at).toISOString() : "", 48),
87
88
  variant: "circular",
88
89
  sx: { width: 32, height: 32 }
@@ -126,6 +127,7 @@ function SupporterTable({ supporters = [], totalAmount = "0", currency, method }
126
127
  x?.updated_at ? new Date(x.updated_at).toISOString() : "",
127
128
  48
128
129
  ),
130
+ alt: x.customer?.name,
129
131
  variant: "circular",
130
132
  sx: { width: 24, height: 24 }
131
133
  },
@@ -169,6 +171,7 @@ function SupporterSimple({ supporters = [], totalAmount = "0", currency, method
169
171
  Avatar,
170
172
  {
171
173
  title: x.customer?.name,
174
+ alt: x.customer?.name,
172
175
  src: getCustomerAvatar(x.customer?.did, x?.updated_at ? new Date(x.updated_at).toISOString() : "", 48),
173
176
  variant: "circular",
174
177
  sx: { width: 24, height: 24 }
@@ -4,6 +4,7 @@ import Toast from "@arcblock/ux/lib/Toast";
4
4
  import { CheckOutlined } from "@mui/icons-material";
5
5
  import { LoadingButton } from "@mui/lab";
6
6
  import {
7
+ Avatar,
7
8
  Box,
8
9
  Chip,
9
10
  List,
@@ -105,7 +106,10 @@ export default function PricingTable({ table, alignItems, interval, mode, onSele
105
106
  const { payment_currencies: paymentCurrencies = [] } = paymentMethod;
106
107
  if (paymentCurrencies && paymentCurrencies.length > 0) {
107
108
  paymentCurrencies.forEach((x) => {
108
- ans[x.id] = x;
109
+ ans[x.id] = {
110
+ ...x,
111
+ method: paymentMethod.name
112
+ };
109
113
  });
110
114
  }
111
115
  });
@@ -264,8 +268,16 @@ export default function PricingTable({ table, alignItems, interval, mode, onSele
264
268
  value: currency?.id,
265
269
  onChange: (e) => setCurrency(currencyList.find((v) => v?.id === e.target.value)),
266
270
  size: "small",
267
- sx: { m: 1, width: 120 },
268
- children: currencyList.map((x) => /* @__PURE__ */ jsx(MenuItem, { value: x?.id, children: /* @__PURE__ */ jsx(Typography, { color: x?.id === currency?.id ? "text.primary" : "text.secondary", children: x?.symbol }) }, x?.id))
271
+ sx: { m: 1, minWidth: 180 },
272
+ children: currencyList.map((x) => /* @__PURE__ */ jsx(MenuItem, { value: x?.id, children: /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", gap: 1, children: [
273
+ /* @__PURE__ */ jsx(Avatar, { src: x?.logo, sx: { width: 20, height: 20 }, alt: x?.symbol }),
274
+ /* @__PURE__ */ jsxs(Typography, { fontSize: "12px", color: "text.secondary", children: [
275
+ x?.symbol,
276
+ "\uFF08",
277
+ x?.method,
278
+ "\uFF09"
279
+ ] })
280
+ ] }) }, x?.id))
269
281
  }
270
282
  )
271
283
  ] }),
@@ -20,7 +20,15 @@ export default function PaymentHeader({ checkoutSession }) {
20
20
  }, [domSize, theme]);
21
21
  return /* @__PURE__ */ jsxs(Stack, { className: "cko-header", direction: "row", spacing: 1, alignItems: "center", justifyContent: "space-between", children: [
22
22
  /* @__PURE__ */ jsxs(Stack, { direction: "row", spacing: 1, alignItems: "center", children: [
23
- /* @__PURE__ */ jsx(Avatar, { variant: "square", src: window.blocklet.appLogo, sx: { width: 32, height: 32 } }),
23
+ /* @__PURE__ */ jsx(
24
+ Avatar,
25
+ {
26
+ variant: "square",
27
+ src: window.blocklet.appLogo,
28
+ sx: { width: 32, height: 32 },
29
+ alt: window.blocklet?.appName || "Logo"
30
+ }
31
+ ),
24
32
  /* @__PURE__ */ jsx(Typography, { sx: { color: "text.primary", fontWeight: 600 }, children: brand }),
25
33
  !livemode && /* @__PURE__ */ jsx(Livemode, {})
26
34
  ] }),
@@ -91,6 +91,7 @@ function SupporterAvatar({
91
91
  max: 20,
92
92
  children: customers.map(x => /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
93
93
  title: x.customer?.name,
94
+ alt: x.customer?.name,
94
95
  src: (0, _util.getCustomerAvatar)(x.customer?.did, x?.updated_at ? new Date(x.updated_at).toISOString() : "", 48),
95
96
  variant: "circular",
96
97
  sx: {
@@ -156,6 +157,7 @@ function SupporterTable({
156
157
  spacing: 0.5,
157
158
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
158
159
  src: (0, _util.getCustomerAvatar)(x.customer?.did, x?.updated_at ? new Date(x.updated_at).toISOString() : "", 48),
160
+ alt: x.customer?.name,
159
161
  variant: "circular",
160
162
  sx: {
161
163
  width: 24,
@@ -241,6 +243,7 @@ function SupporterSimple({
241
243
  max: 10,
242
244
  children: customers.map(x => /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
243
245
  title: x.customer?.name,
246
+ alt: x.customer?.name,
244
247
  src: (0, _util.getCustomerAvatar)(x.customer?.did, x?.updated_at ? new Date(x.updated_at).toISOString() : "", 48),
245
248
  variant: "circular",
246
249
  sx: {
@@ -116,7 +116,10 @@ function PricingTable({
116
116
  } = paymentMethod;
117
117
  if (paymentCurrencies && paymentCurrencies.length > 0) {
118
118
  paymentCurrencies.forEach(x => {
119
- ans[x.id] = x;
119
+ ans[x.id] = {
120
+ ...x,
121
+ method: paymentMethod.name
122
+ };
120
123
  });
121
124
  }
122
125
  });
@@ -281,13 +284,26 @@ function PricingTable({
281
284
  size: "small",
282
285
  sx: {
283
286
  m: 1,
284
- width: 120
287
+ minWidth: 180
285
288
  },
286
289
  children: currencyList.map(x => /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.MenuItem, {
287
290
  value: x?.id,
288
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
289
- color: x?.id === currency?.id ? "text.primary" : "text.secondary",
290
- children: x?.symbol
291
+ children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
292
+ direction: "row",
293
+ alignItems: "center",
294
+ gap: 1,
295
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
296
+ src: x?.logo,
297
+ sx: {
298
+ width: 20,
299
+ height: 20
300
+ },
301
+ alt: x?.symbol
302
+ }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
303
+ fontSize: "12px",
304
+ color: "text.secondary",
305
+ children: [x?.symbol, "\uFF08", x?.method, "\uFF09"]
306
+ })]
291
307
  })
292
308
  }, x?.id))
293
309
  })]
@@ -45,7 +45,8 @@ function PaymentHeader({
45
45
  sx: {
46
46
  width: 32,
47
47
  height: 32
48
- }
48
+ },
49
+ alt: window.blocklet?.appName || "Logo"
49
50
  }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
50
51
  sx: {
51
52
  color: "text.primary",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/payment-react",
3
- "version": "1.17.11",
3
+ "version": "1.18.0",
4
4
  "description": "Reusable react components for payment kit v2",
5
5
  "keywords": [
6
6
  "react",
@@ -92,7 +92,7 @@
92
92
  "@babel/core": "^7.25.2",
93
93
  "@babel/preset-env": "^7.25.2",
94
94
  "@babel/preset-react": "^7.24.7",
95
- "@blocklet/payment-types": "1.17.11",
95
+ "@blocklet/payment-types": "1.18.0",
96
96
  "@storybook/addon-essentials": "^7.6.20",
97
97
  "@storybook/addon-interactions": "^7.6.20",
98
98
  "@storybook/addon-links": "^7.6.20",
@@ -123,5 +123,5 @@
123
123
  "vite-plugin-babel": "^1.2.0",
124
124
  "vite-plugin-node-polyfills": "^0.21.0"
125
125
  },
126
- "gitHead": "286c7709d37515078269b963b1e7381f599111cc"
126
+ "gitHead": "052c301e1f565558766c9346ba355f2fd072108e"
127
127
  }
@@ -144,6 +144,7 @@ function SupporterAvatar({ supporters = [], totalAmount = '0', currency, method
144
144
  <Avatar
145
145
  key={x.id}
146
146
  title={x.customer?.name}
147
+ alt={x.customer?.name}
147
148
  src={getCustomerAvatar(x.customer?.did, x?.updated_at ? new Date(x.updated_at).toISOString() : '', 48)}
148
149
  variant="circular"
149
150
  sx={{ width: 32, height: 32 }}
@@ -196,6 +197,7 @@ function SupporterTable({ supporters = [], totalAmount = '0', currency, method }
196
197
  x?.updated_at ? new Date(x.updated_at).toISOString() : '',
197
198
  48
198
199
  )}
200
+ alt={x.customer?.name}
199
201
  variant="circular"
200
202
  sx={{ width: 24, height: 24 }}
201
203
  />
@@ -259,6 +261,7 @@ function SupporterSimple({ supporters = [], totalAmount = '0', currency, method
259
261
  <Avatar
260
262
  key={x.id}
261
263
  title={x.customer?.name}
264
+ alt={x.customer?.name}
262
265
  src={getCustomerAvatar(x.customer?.did, x?.updated_at ? new Date(x.updated_at).toISOString() : '', 48)}
263
266
  variant="circular"
264
267
  sx={{ width: 24, height: 24 }}
@@ -5,6 +5,7 @@ import type { PriceCurrency, PriceRecurring, TPricingTableExpanded, TPricingTabl
5
5
  import { CheckOutlined } from '@mui/icons-material';
6
6
  import { LoadingButton } from '@mui/lab';
7
7
  import {
8
+ Avatar,
8
9
  Box,
9
10
  Chip,
10
11
  List,
@@ -130,7 +131,10 @@ export default function PricingTable({ table, alignItems, interval, mode, onSele
130
131
  const { payment_currencies: paymentCurrencies = [] } = paymentMethod;
131
132
  if (paymentCurrencies && paymentCurrencies.length > 0) {
132
133
  paymentCurrencies.forEach((x: { id: string; symbol: string }) => {
133
- ans[x.id] = x;
134
+ ans[x.id] = {
135
+ ...x,
136
+ method: paymentMethod.name,
137
+ };
134
138
  });
135
139
  }
136
140
  });
@@ -297,12 +301,15 @@ export default function PricingTable({ table, alignItems, interval, mode, onSele
297
301
  value={currency?.id}
298
302
  onChange={(e) => setCurrency(currencyList.find((v) => v?.id === e.target.value))}
299
303
  size="small"
300
- sx={{ m: 1, width: 120 }}>
304
+ sx={{ m: 1, minWidth: 180 }}>
301
305
  {currencyList.map((x) => (
302
306
  <MenuItem key={x?.id} value={x?.id}>
303
- <Typography color={x?.id === currency?.id ? 'text.primary' : 'text.secondary'}>
304
- {x?.symbol}
305
- </Typography>
307
+ <Stack direction="row" alignItems="center" gap={1}>
308
+ <Avatar src={x?.logo} sx={{ width: 20, height: 20 }} alt={x?.symbol} />
309
+ <Typography fontSize="12px" color="text.secondary">
310
+ {x?.symbol}({x?.method})
311
+ </Typography>
312
+ </Stack>
306
313
  </MenuItem>
307
314
  ))}
308
315
  </Select>
@@ -30,7 +30,12 @@ export default function PaymentHeader({ checkoutSession }: Props) {
30
30
  return (
31
31
  <Stack className="cko-header" direction="row" spacing={1} alignItems="center" justifyContent="space-between">
32
32
  <Stack direction="row" spacing={1} alignItems="center">
33
- <Avatar variant="square" src={window.blocklet.appLogo} sx={{ width: 32, height: 32 }} />
33
+ <Avatar
34
+ variant="square"
35
+ src={window.blocklet.appLogo}
36
+ sx={{ width: 32, height: 32 }}
37
+ alt={window.blocklet?.appName || 'Logo'}
38
+ />
34
39
  <Typography sx={{ color: 'text.primary', fontWeight: 600 }}>{brand}</Typography>
35
40
  {!livemode && <Livemode />}
36
41
  </Stack>