@blocklet/payment-react 1.20.20 → 1.20.22

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.
@@ -22,6 +22,7 @@ const Table = _react.default.memo(({
22
22
  footer = true,
23
23
  hasRowLink = false,
24
24
  emptyNodeText = "",
25
+ bordered = true,
25
26
  ...rest
26
27
  }) => {
27
28
  const {
@@ -67,7 +68,8 @@ const Table = _react.default.memo(({
67
68
  ...rest,
68
69
  components,
69
70
  hasRowLink,
70
- isMobile
71
+ isMobile,
72
+ bordered
71
73
  });
72
74
  });
73
75
  const Wrapped = (0, _system.styled)(_Datatable.default)`
@@ -75,27 +77,23 @@ const Wrapped = (0, _system.styled)(_Datatable.default)`
75
77
  font-size: 0.875rem !important;
76
78
  }` : ""}
77
79
  .MuiPaper-root {
78
- border-radius: 8px;
80
+ border-radius: ${props => props?.bordered ? "8px" : "0"};
79
81
  overflow: hidden;
80
82
  }
81
83
  table.MuiTable-root {
82
- outline: 1px solid;
83
- outline-color: ${({
84
- theme
85
- }) => theme.palette.divider};
86
- border-radius: ${({
87
- theme
88
- }) => `${2 * theme.shape.borderRadius}px`};
84
+ ${props => props?.bordered ? `
85
+ outline: 1px solid;
86
+ outline-color: ${props.theme.palette.divider};
87
+ border-radius: ${2 * props.theme.shape.borderRadius}px;
88
+ ` : ""}
89
89
  overflow: hidden;
90
90
  }
91
91
  [class*='MUIDataTable-responsiveBase'] {
92
- outline: 1px solid;
93
- outline-color: ${({
94
- theme
95
- }) => theme.palette.divider};
96
- border-radius: ${({
97
- theme
98
- }) => `${2 * theme.shape.borderRadius}px`};
92
+ ${props => props?.bordered ? `
93
+ outline: 1px solid;
94
+ outline-color: ${props.theme.palette.divider};
95
+ border-radius: ${2 * props.theme.shape.borderRadius}px;
96
+ ` : ""}
99
97
  }
100
98
 
101
99
  th.MuiTableCell-head {
@@ -106,11 +104,11 @@ const Wrapped = (0, _system.styled)(_Datatable.default)`
106
104
  }) => theme.palette.grey[50]};
107
105
  border-bottom: none;
108
106
  &:first-of-type {
109
- border-top-left-radius: 8px;
107
+ ${props => props?.bordered ? "border-top-left-radius: 8px;" : ""}
110
108
  padding-left: 20px;
111
109
  }
112
110
  &:last-of-type {
113
- border-top-right-radius: 8px;
111
+ ${props => props?.bordered ? "border-top-right-radius: 8px;" : ""}
114
112
  }
115
113
  }
116
114
 
@@ -120,11 +118,11 @@ const Wrapped = (0, _system.styled)(_Datatable.default)`
120
118
  }) => theme.palette.grey[100]};
121
119
  }
122
120
  tr.MuiTableRow-root:last-of-type td:first-of-type {
123
- border-bottom-left-radius: 8px;
121
+ ${props => props?.bordered ? "border-bottom-left-radius: 8px;" : ""}
124
122
  }
125
123
 
126
124
  tr.MuiTableRow-root:last-of-type td:last-of-type {
127
- border-bottom-right-radius: 8px;
125
+ ${props => props?.bordered ? "border-bottom-right-radius: 8px;" : ""}
128
126
  }
129
127
 
130
128
  tr.MuiTableRow-root:nth-of-type(even) {
@@ -239,6 +237,18 @@ const Wrapped = (0, _system.styled)(_Datatable.default)`
239
237
  [class*='MUIDataTable-responsiveBase'] tr:not([class*='responsiveSimple']) td.MuiTableCell-body > div {
240
238
  width: inherit;
241
239
  }
240
+ ${({
241
+ mobileTDFlexDirection
242
+ }) => mobileTDFlexDirection === "row" ? `
243
+ .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > td.MuiTableCell-root {
244
+ align-items: center;
245
+ padding: 4px 0;
246
+ > div {
247
+ width: fit-content;
248
+ flex: inherit;
249
+ }
250
+ }
251
+ ` : ""}
242
252
  }
243
253
  `;
244
254
  module.exports = Table;
package/lib/locales/en.js CHANGED
@@ -192,7 +192,17 @@ module.exports = (0, _flat.default)({
192
192
  progress: "Progress {progress}%",
193
193
  delivered: "Installation completed",
194
194
  failed: "Processing failed",
195
- failedMsg: "An exception occurred during installation. We will automatically process a refund for you. We apologize for the inconvenience. Thank you for your understanding!"
195
+ failedMsg: "An exception occurred during installation. We will automatically process a refund for you. We apologize for the inconvenience. Thank you for your understanding!",
196
+ launcher: {
197
+ processing: "Installing {name}",
198
+ completed: "{name} installed successfully",
199
+ failed: "Failed to install {name}"
200
+ },
201
+ didnames: {
202
+ processing: "Domain ({domain}) registering",
203
+ completed: "Domain ({domain}) registered successfully",
204
+ failed: "Domain ({domain}) registered failed"
205
+ }
196
206
  },
197
207
  confirm: {
198
208
  withStake: "By confirming, you allow {payee} to charge your account for future payments and, if necessary, slash your stake. You can cancel your subscription or withdraw your stake at any time.",
package/lib/locales/zh.js CHANGED
@@ -192,7 +192,17 @@ module.exports = (0, _flat.default)({
192
192
  progress: "\u8FDB\u5EA6 {progress}%",
193
193
  delivered: "\u5B89\u88C5\u6210\u529F",
194
194
  failed: "\u5B89\u88C5\u5931\u8D25",
195
- failedMsg: "\u5F88\u62B1\u6B49\uFF0C\u5B89\u88C5\u8FC7\u7A0B\u4E2D\u9047\u5230\u4E86\u4E00\u4E9B\u95EE\u9898\u3002\u6211\u4EEC\u6B63\u5728\u5904\u7406\u8FD9\u4E2A\u95EE\u9898\uFF0C\u7A0D\u540E\u4F1A\u81EA\u52A8\u4E3A\u60A8\u9000\u6B3E\u3002\u611F\u8C22\u60A8\u7684\u8010\u5FC3\u7B49\u5F85\uFF01"
195
+ failedMsg: "\u5F88\u62B1\u6B49\uFF0C\u5B89\u88C5\u8FC7\u7A0B\u4E2D\u9047\u5230\u4E86\u4E00\u4E9B\u95EE\u9898\u3002\u6211\u4EEC\u6B63\u5728\u5904\u7406\u8FD9\u4E2A\u95EE\u9898\uFF0C\u7A0D\u540E\u4F1A\u81EA\u52A8\u4E3A\u60A8\u9000\u6B3E\u3002\u611F\u8C22\u60A8\u7684\u8010\u5FC3\u7B49\u5F85\uFF01",
196
+ launcher: {
197
+ processing: "\u6B63\u5728\u5B89\u88C5 {name}",
198
+ completed: "\u5B89\u88C5 {name} \u6210\u529F",
199
+ failed: "\u5B89\u88C5 {name} \u5931\u8D25"
200
+ },
201
+ didnames: {
202
+ processing: "\u6B63\u5728\u6CE8\u518C {domain}",
203
+ completed: "\u6CE8\u518C {domain} \u6210\u529F",
204
+ failed: "\u6CE8\u518C {domain} \u5931\u8D25"
205
+ }
196
206
  },
197
207
  confirm: {
198
208
  withStake: "\u786E\u8BA4\u8BA2\u9605\uFF0C\u5373\u8868\u793A\u60A8\u6388\u6743 {payee} \u4ECE\u60A8\u7684\u8D26\u6237\u6263\u53D6\u672A\u6765\u6B3E\u9879\uFF0C\u5E76\u5728\u5FC5\u8981\u65F6\u7F5A\u6CA1\u8D28\u62BC\u3002\u60A8\u53EF\u968F\u65F6\u53D6\u6D88\u8BA2\u9605\u6216\u64A4\u9500\u8D28\u62BC\u3002",
@@ -577,10 +577,17 @@ function PaymentForm({
577
577
  });
578
578
  await handleConnected();
579
579
  };
580
- const onStripeCancel = () => {
581
- setState({
582
- stripePaying: false
583
- });
580
+ const onStripeCancel = async () => {
581
+ try {
582
+ await _api.default.post(`/api/checkout-sessions/${checkoutSession.id}/abort-stripe`);
583
+ } catch (err) {
584
+ console.error(err);
585
+ _Toast.default.error((0, _util2.formatError)(err));
586
+ } finally {
587
+ setState({
588
+ stripePaying: false
589
+ });
590
+ }
584
591
  };
585
592
  (0, _react.useEffect)(() => {
586
593
  const handleKeyDown = e => {
@@ -360,7 +360,9 @@ function PaymentInner({
360
360
  children: [completed && /* @__PURE__ */(0, _jsxRuntime.jsx)(_success.default, {
361
361
  mode,
362
362
  pageInfo: state.checkoutSession.metadata?.page_info,
363
- hasVendor: state.checkoutSession.metadata?.page_info?.hasVendor || state.checkoutSession.line_items.some(item => item.price?.product?.vendor_config?.length > 0),
363
+ vendorCount: state.checkoutSession.line_items.reduce((total, item) => {
364
+ return total + (item.price?.product?.vendor_config?.length || 0);
365
+ }, 0),
364
366
  sessionId: state.checkoutSession.id,
365
367
  payee: (0, _util2.getStatementDescriptor)(state.checkoutSession.line_items),
366
368
  action: state.checkoutSession.mode,
@@ -1,3 +1,4 @@
1
+ export declare function VendorPlaceholder(): import("react").JSX.Element;
1
2
  interface VendorStatus {
2
3
  success: boolean;
3
4
  name?: string;
@@ -7,6 +8,7 @@ interface VendorStatus {
7
8
  message: string;
8
9
  appUrl?: string;
9
10
  title?: string;
11
+ vendorType: string;
10
12
  }
11
13
  export declare function VendorProgressItem({ vendor }: {
12
14
  vendor: VendorStatus;
@@ -3,11 +3,73 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.VendorPlaceholder = VendorPlaceholder;
6
7
  exports.VendorProgressItem = VendorProgressItem;
7
8
  var _jsxRuntime = require("react/jsx-runtime");
8
9
  var _context = require("@arcblock/ux/lib/Locale/context");
9
10
  var _material = require("@mui/material");
10
11
  var _react = require("react");
12
+ var _iconsMaterial = require("@mui/icons-material");
13
+ function VendorPlaceholder() {
14
+ return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
15
+ sx: {
16
+ mb: 2
17
+ },
18
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
19
+ sx: {
20
+ display: "flex",
21
+ justifyContent: "space-between",
22
+ alignItems: "center",
23
+ mb: 1
24
+ },
25
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
26
+ variant: "rounded",
27
+ height: 16,
28
+ width: 150
29
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
30
+ variant: "rounded",
31
+ height: 16,
32
+ width: 50
33
+ })]
34
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
35
+ variant: "rounded",
36
+ height: 8,
37
+ width: "100%"
38
+ })]
39
+ });
40
+ }
41
+ const getVendorLabel = (vendor, isFailed, t) => {
42
+ const name = vendor.name || vendor.title;
43
+ const isCompleted = vendor.status === "delivered";
44
+ if (vendor.vendorType === "didnames") {
45
+ if (isFailed) {
46
+ return t("payment.checkout.vendor.didnames.failed", {
47
+ name
48
+ });
49
+ }
50
+ if (isCompleted) {
51
+ return t("payment.checkout.vendor.didnames.completed", {
52
+ name
53
+ });
54
+ }
55
+ return t("payment.checkout.vendor.didnames.processing", {
56
+ name
57
+ });
58
+ }
59
+ if (isFailed) {
60
+ return t("payment.checkout.vendor.launcher.failed", {
61
+ name
62
+ });
63
+ }
64
+ if (isCompleted) {
65
+ return t("payment.checkout.vendor.launcher.completed", {
66
+ name
67
+ });
68
+ }
69
+ return t("payment.checkout.vendor.launcher.processing", {
70
+ name
71
+ });
72
+ };
11
73
  function VendorProgressItem({
12
74
  vendor
13
75
  }) {
@@ -39,7 +101,7 @@ function VendorProgressItem({
39
101
  newProgress = Math.min(startProgress + elapsed / 1e3, 99);
40
102
  }
41
103
  newProgress = Math.round(newProgress);
42
- setDisplayProgress(pre => pre > newProgress ? pre : newProgress);
104
+ setDisplayProgress(pre => Math.min(pre > newProgress ? pre : newProgress, 100));
43
105
  if (realProgress === 100) {
44
106
  return;
45
107
  }
@@ -62,7 +124,7 @@ function VendorProgressItem({
62
124
  }, [startAnimation]);
63
125
  const isCompleted = displayProgress >= 100;
64
126
  const isFailed = vendor.status === "failed";
65
- const nameText = vendor.name || vendor.title;
127
+ const nameText = getVendorLabel(vendor, isFailed, t);
66
128
  if (isFailed) {
67
129
  return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
68
130
  sx: {
@@ -80,7 +142,7 @@ function VendorProgressItem({
80
142
  sx: {
81
143
  color: "text.secondary"
82
144
  },
83
- children: nameText ? `${nameText} - ${t("payment.checkout.vendor.failed")}` : t("payment.checkout.vendor.failed")
145
+ children: nameText
84
146
  }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
85
147
  variant: "body2",
86
148
  sx: {
@@ -106,7 +168,9 @@ function VendorProgressItem({
106
168
  })]
107
169
  });
108
170
  }
109
- const statusText = isCompleted ? t("payment.checkout.vendor.delivered") : t("payment.checkout.vendor.processing");
171
+ if (!vendor.name && !vendor.title) {
172
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(VendorPlaceholder, {});
173
+ }
110
174
  return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
111
175
  sx: {
112
176
  mb: 2
@@ -118,13 +182,21 @@ function VendorProgressItem({
118
182
  alignItems: "center",
119
183
  mb: 1
120
184
  },
121
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
185
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
122
186
  variant: "body2",
123
187
  sx: {
124
- color: "text.secondary"
188
+ color: "text.secondary",
189
+ display: "flex",
190
+ alignItems: "center"
125
191
  },
126
- children: nameText ? `${nameText} - ${statusText}` : statusText
127
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
192
+ children: [nameText, " ", isCompleted ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_iconsMaterial.Check, {
193
+ sx: {
194
+ color: "success.main",
195
+ ml: 0.5
196
+ },
197
+ fontSize: "small"
198
+ }) : null]
199
+ }), isCompleted ? null : /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
128
200
  variant: "body2",
129
201
  sx: {
130
202
  color: "text.secondary",
@@ -136,7 +208,7 @@ function VendorProgressItem({
136
208
  })]
137
209
  }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.LinearProgress, {
138
210
  variant: "determinate",
139
- value: Math.min(displayProgress, 100),
211
+ value: displayProgress || 0,
140
212
  sx: {
141
213
  height: 8,
142
214
  borderRadius: 4,
@@ -1,7 +1,7 @@
1
1
  type Props = {
2
2
  mode: string;
3
3
  pageInfo?: any;
4
- hasVendor?: boolean;
4
+ vendorCount?: number;
5
5
  sessionId?: string;
6
6
  message: string;
7
7
  action: string;
@@ -10,5 +10,5 @@ type Props = {
10
10
  subscriptionId?: string;
11
11
  subscriptions?: any[];
12
12
  };
13
- export default function PaymentSuccess({ mode, pageInfo, hasVendor, sessionId, message, action, payee, invoiceId, subscriptionId, subscriptions, }: Props): import("react").JSX.Element;
13
+ export default function PaymentSuccess({ mode, pageInfo, vendorCount, sessionId, message, action, payee, invoiceId, subscriptionId, subscriptions, }: Props): import("react").JSX.Element;
14
14
  export {};
@@ -15,7 +15,7 @@ var _progressItem = require("./progress-item");
15
15
  function PaymentSuccess({
16
16
  mode,
17
17
  pageInfo = {},
18
- hasVendor = false,
18
+ vendorCount = 0,
19
19
  sessionId = "",
20
20
  message,
21
21
  action,
@@ -38,7 +38,7 @@ function PaymentSuccess({
38
38
  const timerRef = (0, _react.useRef)(Date.now());
39
39
  let next = null;
40
40
  (0, _react.useEffect)(() => {
41
- if (!hasVendor || !sessionId) return void 0;
41
+ if (vendorCount === 0 || !sessionId) return void 0;
42
42
  const fetchVendorStatus = async interval2 => {
43
43
  try {
44
44
  const response = await api.get((0, _ufo.joinURL)(prefix, `/api/vendors/order/${sessionId}/status`), {});
@@ -60,9 +60,24 @@ function PaymentSuccess({
60
60
  fetchVendorStatus(interval);
61
61
  }, 5e3);
62
62
  return () => clearInterval(interval);
63
- }, [hasVendor, api, prefix, sessionId]);
63
+ }, [vendorCount, api, prefix, sessionId]);
64
+ const renderPlaceholders = () => {
65
+ const placeholders = [];
66
+ for (let i = 0; i < vendorCount; i++) {
67
+ placeholders.push(/* @__PURE__ */(0, _jsxRuntime.jsx)(_progressItem.VendorPlaceholder, {}, `placeholder-${i}`));
68
+ }
69
+ return placeholders;
70
+ };
71
+ const renderVendors = () => {
72
+ if (!vendorStatus) return renderPlaceholders();
73
+ return vendorStatus.vendors?.map((vendor, index) => {
74
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_progressItem.VendorProgressItem, {
75
+ vendor
76
+ }, vendor.title || `vendor-${index}`);
77
+ });
78
+ };
64
79
  const renderVendorProgress = () => {
65
- if (!hasVendor || !vendorStatus) return null;
80
+ if (vendorCount === 0) return null;
66
81
  return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Paper, {
67
82
  elevation: 0,
68
83
  sx: {
@@ -75,9 +90,7 @@ function PaymentSuccess({
75
90
  flexDirection: "column",
76
91
  gap: 2
77
92
  },
78
- children: [vendorStatus.vendors?.map((vendor, index) => /* @__PURE__ */(0, _jsxRuntime.jsx)(_progressItem.VendorProgressItem, {
79
- vendor
80
- }, vendor.title || `vendor-${index}`)), hasFailed ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
93
+ children: [renderVendors(), hasFailed ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
81
94
  variant: "h6",
82
95
  sx: {
83
96
  color: "warning.main",
@@ -214,6 +214,7 @@ function PaymentSummary({
214
214
  });
215
215
  }
216
216
  };
217
+ const hasSubTotal = +staking > 0 || allowPromotionCodes;
217
218
  const ProductCardList = /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
218
219
  className: "cko-product-list",
219
220
  sx: {
@@ -368,7 +369,8 @@ function PaymentSummary({
368
369
  mt: 2.5,
369
370
  mb: 2.5
370
371
  }
371
- }), +staking > 0 && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
372
+ }), +staking > 0 && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
373
+ spacing: 1,
372
374
  children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
373
375
  direction: "row",
374
376
  spacing: 1,
@@ -469,9 +471,6 @@ function PaymentSummary({
469
471
  currencyId: currency.id
470
472
  })
471
473
  }), hasDiscounts && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
472
- sx: {
473
- py: 1.5
474
- },
475
474
  children: sessionDiscounts.map(discount => {
476
475
  const promotionCodeInfo = discount.promotion_code_details;
477
476
  const couponInfo = discount.coupon_details;
@@ -493,13 +492,12 @@ function PaymentSummary({
493
492
  backgroundColor: "grey.100",
494
493
  width: "fit-content",
495
494
  px: 1,
496
- py: 0.5,
495
+ py: 1,
497
496
  borderRadius: 1
498
497
  },
499
498
  children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
500
499
  sx: {
501
500
  fontWeight: "medium",
502
- fontSize: "small",
503
501
  display: "flex",
504
502
  alignItems: "center",
505
503
  gap: 0.5
@@ -545,6 +543,10 @@ function PaymentSummary({
545
543
  })]
546
544
  }, discount.promotion_code || discount.coupon || `discount-${discount.discount_amount}`);
547
545
  })
546
+ }), hasSubTotal && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Divider, {
547
+ sx: {
548
+ my: 1
549
+ }
548
550
  }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
549
551
  sx: {
550
552
  display: "flex",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/payment-react",
3
- "version": "1.20.20",
3
+ "version": "1.20.22",
4
4
  "description": "Reusable react components for payment kit v2",
5
5
  "keywords": [
6
6
  "react",
@@ -94,7 +94,7 @@
94
94
  "@babel/core": "^7.27.4",
95
95
  "@babel/preset-env": "^7.27.2",
96
96
  "@babel/preset-react": "^7.27.1",
97
- "@blocklet/payment-types": "1.20.20",
97
+ "@blocklet/payment-types": "1.20.22",
98
98
  "@storybook/addon-essentials": "^7.6.20",
99
99
  "@storybook/addon-interactions": "^7.6.20",
100
100
  "@storybook/addon-links": "^7.6.20",
@@ -125,5 +125,5 @@
125
125
  "vite-plugin-babel": "^1.3.1",
126
126
  "vite-plugin-node-polyfills": "^0.23.0"
127
127
  },
128
- "gitHead": "0aa636abf410af4ba08cf03fd4a15ae3beab115d"
128
+ "gitHead": "a0a691de0cd6e47efbc0e4de01d200bb9193c435"
129
129
  }
@@ -12,7 +12,16 @@ function EmptyStub() {
12
12
  }
13
13
 
14
14
  const Table = React.memo(
15
- ({ options, columns, toolbar = true, footer = true, hasRowLink = false, emptyNodeText = '', ...rest }: any) => {
15
+ ({
16
+ options,
17
+ columns,
18
+ toolbar = true,
19
+ footer = true,
20
+ hasRowLink = false,
21
+ emptyNodeText = '',
22
+ bordered = true,
23
+ ...rest
24
+ }: any) => {
16
25
  const { locale, t } = useLocaleContext();
17
26
  const { isMobile } = useMobile();
18
27
 
@@ -52,6 +61,7 @@ const Table = React.memo(
52
61
  components={components}
53
62
  hasRowLink={hasRowLink}
54
63
  isMobile={isMobile}
64
+ bordered={bordered}
55
65
  />
56
66
  );
57
67
  }
@@ -64,6 +74,7 @@ interface TableProps {
64
74
  footer?: boolean;
65
75
  hasRowLink?: boolean;
66
76
  emptyNodeText?: string;
77
+ bordered?: boolean;
67
78
  mobileTDFlexDirection?: string;
68
79
  }
69
80
 
@@ -75,19 +86,29 @@ const Wrapped = styled(Datatable)`
75
86
  }`
76
87
  : ''}
77
88
  .MuiPaper-root {
78
- border-radius: 8px;
89
+ border-radius: ${(props: any) => (props?.bordered ? '8px' : '0')};
79
90
  overflow: hidden;
80
91
  }
81
92
  table.MuiTable-root {
82
- outline: 1px solid;
83
- outline-color: ${({ theme }) => theme.palette.divider};
84
- border-radius: ${({ theme }) => `${2 * (theme.shape.borderRadius as number)}px`};
93
+ ${(props: any) =>
94
+ props?.bordered
95
+ ? `
96
+ outline: 1px solid;
97
+ outline-color: ${props.theme.palette.divider};
98
+ border-radius: ${2 * (props.theme.shape.borderRadius as number)}px;
99
+ `
100
+ : ''}
85
101
  overflow: hidden;
86
102
  }
87
103
  [class*='MUIDataTable-responsiveBase'] {
88
- outline: 1px solid;
89
- outline-color: ${({ theme }) => theme.palette.divider};
90
- border-radius: ${({ theme }) => `${2 * (theme.shape.borderRadius as number)}px`};
104
+ ${(props: any) =>
105
+ props?.bordered
106
+ ? `
107
+ outline: 1px solid;
108
+ outline-color: ${props.theme.palette.divider};
109
+ border-radius: ${2 * (props.theme.shape.borderRadius as number)}px;
110
+ `
111
+ : ''}
91
112
  }
92
113
 
93
114
  th.MuiTableCell-head {
@@ -96,11 +117,11 @@ const Wrapped = styled(Datatable)`
96
117
  background: ${({ theme }) => theme.palette.grey[50]};
97
118
  border-bottom: none;
98
119
  &:first-of-type {
99
- border-top-left-radius: 8px;
120
+ ${(props: any) => (props?.bordered ? 'border-top-left-radius: 8px;' : '')}
100
121
  padding-left: 20px;
101
122
  }
102
123
  &:last-of-type {
103
- border-top-right-radius: 8px;
124
+ ${(props: any) => (props?.bordered ? 'border-top-right-radius: 8px;' : '')}
104
125
  }
105
126
  }
106
127
 
@@ -108,11 +129,11 @@ const Wrapped = styled(Datatable)`
108
129
  background: ${({ theme }) => theme.palette.grey[100]};
109
130
  }
110
131
  tr.MuiTableRow-root:last-of-type td:first-of-type {
111
- border-bottom-left-radius: 8px;
132
+ ${(props: any) => (props?.bordered ? 'border-bottom-left-radius: 8px;' : '')}
112
133
  }
113
134
 
114
135
  tr.MuiTableRow-root:last-of-type td:last-of-type {
115
- border-bottom-right-radius: 8px;
136
+ ${(props: any) => (props?.bordered ? 'border-bottom-right-radius: 8px;' : '')}
116
137
  }
117
138
 
118
139
  tr.MuiTableRow-root:nth-of-type(even) {
@@ -214,6 +235,19 @@ const Wrapped = styled(Datatable)`
214
235
  [class*='MUIDataTable-responsiveBase'] tr:not([class*='responsiveSimple']) td.MuiTableCell-body > div {
215
236
  width: inherit;
216
237
  }
238
+ ${({ mobileTDFlexDirection }) =>
239
+ mobileTDFlexDirection === 'row'
240
+ ? `
241
+ .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > td.MuiTableCell-root {
242
+ align-items: center;
243
+ padding: 4px 0;
244
+ > div {
245
+ width: fit-content;
246
+ flex: inherit;
247
+ }
248
+ }
249
+ `
250
+ : ''}
217
251
  }
218
252
  `;
219
253
 
@@ -190,6 +190,16 @@ export default flat({
190
190
  failed: 'Processing failed',
191
191
  failedMsg:
192
192
  'An exception occurred during installation. We will automatically process a refund for you. We apologize for the inconvenience. Thank you for your understanding!',
193
+ launcher: {
194
+ processing: 'Installing {name}',
195
+ completed: '{name} installed successfully',
196
+ failed: 'Failed to install {name}',
197
+ },
198
+ didnames: {
199
+ processing: 'Domain ({domain}) registering',
200
+ completed: 'Domain ({domain}) registered successfully',
201
+ failed: 'Domain ({domain}) registered failed',
202
+ },
193
203
  },
194
204
  confirm: {
195
205
  withStake:
@@ -188,6 +188,16 @@ export default flat({
188
188
  delivered: '安装成功',
189
189
  failed: '安装失败',
190
190
  failedMsg: '很抱歉,安装过程中遇到了一些问题。我们正在处理这个问题,稍后会自动为您退款。感谢您的耐心等待!',
191
+ launcher: {
192
+ processing: '正在安装 {name}',
193
+ completed: '安装 {name} 成功',
194
+ failed: '安装 {name} 失败',
195
+ },
196
+ didnames: {
197
+ processing: '正在注册 {domain}',
198
+ completed: '注册 {domain} 成功',
199
+ failed: '注册 {domain} 失败',
200
+ },
191
201
  },
192
202
  confirm: {
193
203
  withStake:
@@ -639,8 +639,15 @@ export default function PaymentForm({
639
639
  await handleConnected();
640
640
  };
641
641
 
642
- const onStripeCancel = () => {
643
- setState({ stripePaying: false });
642
+ const onStripeCancel = async () => {
643
+ try {
644
+ await api.post(`/api/checkout-sessions/${checkoutSession.id}/abort-stripe`);
645
+ } catch (err) {
646
+ console.error(err);
647
+ Toast.error(formatError(err));
648
+ } finally {
649
+ setState({ stripePaying: false });
650
+ }
644
651
  };
645
652
 
646
653
  useEffect(() => {
@@ -361,10 +361,9 @@ function PaymentInner({
361
361
  <PaymentSuccess
362
362
  mode={mode}
363
363
  pageInfo={state.checkoutSession.metadata?.page_info}
364
- hasVendor={
365
- state.checkoutSession.metadata?.page_info?.hasVendor ||
366
- state.checkoutSession.line_items.some((item: any) => item.price?.product?.vendor_config?.length > 0)
367
- }
364
+ vendorCount={state.checkoutSession.line_items.reduce((total: number, item: any) => {
365
+ return total + (item.price?.product?.vendor_config?.length || 0);
366
+ }, 0)}
368
367
  sessionId={state.checkoutSession.id}
369
368
  payee={getStatementDescriptor(state.checkoutSession.line_items)}
370
369
  action={state.checkoutSession.mode}