@blocklet/payment-react 1.14.27 → 1.14.29

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 (47) hide show
  1. package/es/checkout/form.js +3 -3
  2. package/es/checkout/table.js +11 -3
  3. package/es/components/livemode.js +1 -1
  4. package/es/components/pricing-table.js +55 -14
  5. package/es/components/table.js +1 -1
  6. package/es/history/invoice/list.js +12 -10
  7. package/es/libs/util.d.ts +1 -0
  8. package/es/libs/util.js +6 -0
  9. package/es/locales/en.js +4 -3
  10. package/es/locales/zh.js +6 -5
  11. package/es/payment/form/address.js +1 -1
  12. package/es/payment/index.d.ts +1 -1
  13. package/es/payment/index.js +4 -1
  14. package/es/payment/product-card.js +2 -2
  15. package/es/payment/skeleton/overview.js +3 -6
  16. package/es/payment/skeleton/payment.js +8 -7
  17. package/lib/checkout/form.js +3 -3
  18. package/lib/checkout/table.js +12 -2
  19. package/lib/components/livemode.js +1 -1
  20. package/lib/components/pricing-table.js +90 -41
  21. package/lib/components/table.js +1 -1
  22. package/lib/history/invoice/list.js +10 -8
  23. package/lib/libs/util.d.ts +1 -0
  24. package/lib/libs/util.js +7 -0
  25. package/lib/locales/en.js +4 -3
  26. package/lib/locales/zh.js +6 -5
  27. package/lib/payment/form/address.js +4 -0
  28. package/lib/payment/index.d.ts +1 -1
  29. package/lib/payment/index.js +8 -1
  30. package/lib/payment/product-card.js +2 -2
  31. package/lib/payment/skeleton/overview.js +9 -14
  32. package/lib/payment/skeleton/payment.js +17 -9
  33. package/package.json +3 -3
  34. package/src/checkout/form.tsx +3 -3
  35. package/src/checkout/table.tsx +11 -3
  36. package/src/components/livemode.tsx +1 -1
  37. package/src/components/pricing-table.tsx +103 -48
  38. package/src/components/table.tsx +1 -1
  39. package/src/history/invoice/list.tsx +11 -10
  40. package/src/libs/util.ts +7 -0
  41. package/src/locales/en.tsx +4 -2
  42. package/src/locales/zh.tsx +5 -4
  43. package/src/payment/form/address.tsx +1 -1
  44. package/src/payment/index.tsx +4 -1
  45. package/src/payment/product-card.tsx +2 -2
  46. package/src/payment/skeleton/overview.tsx +1 -2
  47. package/src/payment/skeleton/payment.tsx +10 -11
@@ -14,16 +14,24 @@ var _system = require("@mui/system");
14
14
  var _ahooks = require("ahooks");
15
15
  var _react = require("react");
16
16
  var _util = require("@ocap/util");
17
+ var _lodash = require("lodash");
17
18
  var _payment = require("../contexts/payment");
18
19
  var _util2 = require("../libs/util");
19
20
  var _amount = _interopRequireDefault(require("../payment/amount"));
21
+ var _mobile = require("../hooks/mobile");
20
22
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23
+ const sortOrder = {
24
+ year: 1,
25
+ month: 2,
26
+ day: 3,
27
+ hour: 4
28
+ };
21
29
  const groupItemsByRecurring = (items, currency) => {
22
30
  const grouped = {};
23
31
  const recurring = {};
24
32
  items.forEach(x => {
25
33
  const key = [x.price.recurring?.interval, x.price.recurring?.interval_count].join("-");
26
- if (x.price.currency_options.find(c => c.currency_id === currency.id)) {
34
+ if (x.price.currency_options?.find(c => c.currency_id === currency.id)) {
27
35
  recurring[key] = x.price.recurring;
28
36
  }
29
37
  if (!grouped[key]) {
@@ -52,6 +60,9 @@ function PricingTable({
52
60
  t,
53
61
  locale
54
62
  } = (0, _context.useLocaleContext)();
63
+ const {
64
+ isMobile
65
+ } = (0, _mobile.useMobile)();
55
66
  const {
56
67
  settings: {
57
68
  paymentMethods = []
@@ -62,6 +73,22 @@ function PricingTable({
62
73
  recurring,
63
74
  grouped
64
75
  } = (0, _react.useMemo)(() => groupItemsByRecurring(table.items, currency), [table.items, currency]);
76
+ const recurringKeysList = (0, _react.useMemo)(() => {
77
+ if ((0, _lodash.isEmpty)(recurring)) {
78
+ return [];
79
+ }
80
+ return Object.keys(recurring).sort((a, b) => {
81
+ const [aType, aValue] = a.split("-");
82
+ const [bType, bValue] = b.split("-");
83
+ if (sortOrder[aType] !== sortOrder[bType]) {
84
+ return sortOrder[aType] - sortOrder[bType];
85
+ }
86
+ if (aValue && bValue) {
87
+ return bValue - aValue;
88
+ }
89
+ return b - a;
90
+ });
91
+ }, [recurring]);
65
92
  const [state, setState] = (0, _ahooks.useSetState)({
66
93
  interval
67
94
  });
@@ -127,12 +154,12 @@ function PricingTable({
127
154
  @media (max-width: ${({
128
155
  theme
129
156
  }) => theme.breakpoints.values.sm}px) {
130
- .price-table-item {
131
- width: 90% !important;
132
- }
133
- .btn-row {
134
- padding: 0 20px;
135
- }
157
+ // .price-table-item {
158
+ // width: 90% !important;
159
+ // }
160
+ // .btn-row {
161
+ // padding: 0 20px;
162
+ // }
136
163
  }
137
164
  @media (min-width: ${({
138
165
  theme
@@ -158,43 +185,62 @@ function PricingTable({
158
185
  sm: mode === "select" ? 3 : 5
159
186
  }
160
187
  },
161
- children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)("div", {
188
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
162
189
  className: "btn-row",
163
- children: [Object.keys(recurring).length > 0 && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.ToggleButtonGroup, {
164
- size: "small",
165
- value: state.interval,
166
- sx: {
167
- padding: "4px",
168
- borderRadius: "36px",
169
- height: "40px",
170
- boxSizing: "border-box",
171
- backgroundColor: "#f1f3f5",
172
- border: 0
173
- },
174
- onChange: (_, value) => {
175
- if (value !== null) {
176
- setState({
177
- interval: value
178
- });
179
- }
180
- },
181
- exclusive: true,
182
- children: Object.keys(recurring).map(x => /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.ToggleButton, {
190
+ flexDirection: "row",
191
+ children: [recurringKeysList.length > 0 && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
192
+ children: isMobile && recurringKeysList.length > 1 ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Select, {
193
+ value: state.interval,
194
+ onChange: e => setState({
195
+ interval: e.target.value
196
+ }),
197
+ size: "small",
198
+ sx: {
199
+ m: 1
200
+ },
201
+ children: recurringKeysList.map(x => /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.MenuItem, {
202
+ value: x,
203
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
204
+ color: x === state.interval ? "text.primary" : "text.secondary",
205
+ children: (0, _util2.formatRecurring)(recurring[x], true, "", locale)
206
+ })
207
+ }, x))
208
+ }) : /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.ToggleButtonGroup, {
183
209
  size: "small",
184
- value: x,
210
+ value: state.interval,
185
211
  sx: {
186
- textTransform: "capitalize",
187
- padding: "5px 12px",
188
- fontSize: "13px",
189
- backgroundColor: x === state.interval ? "#fff !important" : "#f1f3f5 !important",
190
- border: "0px",
191
- "&.Mui-selected": {
192
- borderRadius: "9999px !important",
193
- border: "1px solid #e5e7eb"
212
+ padding: "4px",
213
+ borderRadius: "36px",
214
+ height: "40px",
215
+ boxSizing: "border-box",
216
+ backgroundColor: "#f1f3f5",
217
+ border: 0
218
+ },
219
+ onChange: (_, value) => {
220
+ if (value !== null) {
221
+ setState({
222
+ interval: value
223
+ });
194
224
  }
195
225
  },
196
- children: (0, _util2.formatRecurring)(recurring[x], true, "", locale)
197
- }, x))
226
+ exclusive: true,
227
+ children: recurringKeysList.map(x => /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.ToggleButton, {
228
+ size: "small",
229
+ value: x,
230
+ sx: {
231
+ textTransform: "capitalize",
232
+ padding: "5px 12px",
233
+ fontSize: "13px",
234
+ backgroundColor: x === state.interval ? "#fff !important" : "#f1f3f5 !important",
235
+ border: "0px",
236
+ "&.Mui-selected": {
237
+ borderRadius: "9999px !important",
238
+ border: "1px solid #e5e7eb"
239
+ }
240
+ },
241
+ children: (0, _util2.formatRecurring)(recurring[x], true, "", locale)
242
+ }, x))
243
+ })
198
244
  }), currencyList.length > 0 && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Select, {
199
245
  value: currency?.id,
200
246
  onChange: e => setCurrency(currencyList.find(v => v?.id === e.target.value)),
@@ -241,7 +287,10 @@ function PricingTable({
241
287
  borderColor: mode === "select" && x.is_selected ? "primary.main" : "#ddd",
242
288
  boxShadow: "0 8px 16px rgba(0, 0, 0, 20%)"
243
289
  },
244
- width: "320px",
290
+ width: {
291
+ xs: "100%",
292
+ md: "320px"
293
+ },
245
294
  maxWidth: "360px",
246
295
  padding: "20px",
247
296
  position: "relative"
@@ -389,7 +438,7 @@ function Subscribe({
389
438
  fullWidth: true,
390
439
  size: "medium",
391
440
  variant: "contained",
392
- color: x.is_highlight || x.is_selected ? "primary" : "info",
441
+ color: x.is_highlight || x.is_selected ? "info" : "primary",
393
442
  sx: {
394
443
  fontSize: "16px",
395
444
  padding: "10px 20px",
@@ -103,7 +103,7 @@ const Wrapped = (0, _system.styled)(_Datatable.default)`
103
103
  }
104
104
 
105
105
  tr.MuiTableRow-root:not(.MuiTableRow-footer):hover {
106
- background: #f5f5f5;
106
+ background: var(--backgrounds-bg-highlight, #eff6ff);
107
107
  }
108
108
  tr.MuiTableRow-root:last-of-type td:first-of-type {
109
109
  border-bottom-left-radius: 8px;
@@ -97,8 +97,10 @@ const InvoiceTable = _react.default.memo(props => {
97
97
  refreshDeps: [search]
98
98
  });
99
99
  const columns = [{
100
- label: t("payment.customer.invoice.invoiceNumber"),
101
- name: "number",
100
+ label: t("common.amount"),
101
+ name: "total",
102
+ width: 60,
103
+ align: "right",
102
104
  options: {
103
105
  customBodyRenderLite: (_, index) => {
104
106
  const invoice = data?.list[index];
@@ -107,13 +109,15 @@ const InvoiceTable = _react.default.memo(props => {
107
109
  href: link.url,
108
110
  target: link.external ? "_blank" : target,
109
111
  rel: "noreferrer",
110
- children: invoice?.number
112
+ children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
113
+ children: [(0, _util.formatBNStr)(invoice.total, invoice.paymentCurrency.decimal), "\xA0", invoice.paymentCurrency.symbol]
114
+ })
111
115
  });
112
116
  }
113
117
  }
114
118
  }, {
115
- label: t("common.amount"),
116
- name: "total",
119
+ label: t("payment.customer.invoice.invoiceNumber"),
120
+ name: "number",
117
121
  options: {
118
122
  customBodyRenderLite: (_, index) => {
119
123
  const invoice = data?.list[index];
@@ -122,9 +126,7 @@ const InvoiceTable = _react.default.memo(props => {
122
126
  href: link.url,
123
127
  target: link.external ? "_blank" : target,
124
128
  rel: "noreferrer",
125
- children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
126
- children: [(0, _util.formatBNStr)(invoice.total, invoice.paymentCurrency.decimal), "\xA0", invoice.paymentCurrency.symbol]
127
- })
129
+ children: invoice?.number
128
130
  });
129
131
  }
130
132
  }
@@ -104,3 +104,4 @@ export declare function formatTotalPrice({ product, quantity, priceId, locale, }
104
104
  export declare function formatQuantityInventory(price: TPrice, quantity: string | number, locale?: string): string;
105
105
  export declare function formatSubscriptionStatus(status: string): string;
106
106
  export declare function formatAmountPrecisionLimit(amount: string, locale?: string, precision?: number): string;
107
+ export declare function getWordBreakStyle(value: any): 'break-word' | 'break-all';
package/lib/libs/util.js CHANGED
@@ -43,6 +43,7 @@ exports.getSubscriptionAction = void 0;
43
43
  exports.getSubscriptionStatusColor = getSubscriptionStatusColor;
44
44
  exports.getTxLink = exports.getSubscriptionTimeSummary = void 0;
45
45
  exports.getWebhookStatusColor = getWebhookStatusColor;
46
+ exports.getWordBreakStyle = getWordBreakStyle;
46
47
  exports.isPaymentKitMounted = void 0;
47
48
  exports.isValidCountry = isValidCountry;
48
49
  exports.lazyLoad = lazyLoad;
@@ -967,4 +968,10 @@ function formatAmountPrecisionLimit(amount, locale = "en", precision = 6) {
967
968
  });
968
969
  }
969
970
  return "";
971
+ }
972
+ function getWordBreakStyle(value) {
973
+ if (typeof value === "string" && /\s/.test(value)) {
974
+ return "break-word";
975
+ }
976
+ return "break-all";
970
977
  }
package/lib/locales/en.js CHANGED
@@ -94,7 +94,8 @@ module.exports = (0, _flat.default)({
94
94
  recoverFrom: "Recovered From",
95
95
  quantityLimitPerCheckout: "Exceed purchase limit",
96
96
  quantityNotEnough: "Exceed inventory",
97
- amountPrecisionLimit: "Amount decimal places must be less than or equal to {precision}"
97
+ amountPrecisionLimit: "Amount decimal places must be less than or equal to {precision}",
98
+ saveAsDefaultPriceSuccess: "Set default price successfully"
98
99
  },
99
100
  payment: {
100
101
  checkout: {
@@ -200,7 +201,7 @@ module.exports = (0, _flat.default)({
200
201
  invoices: "Invoice History",
201
202
  details: "Details",
202
203
  summary: "Summary",
203
- specifics: "Specifics",
204
+ products: "Products",
204
205
  update: "Update Information",
205
206
  empty: "Seems you do not have any subscriptions or payments here",
206
207
  cancel: {
@@ -233,7 +234,7 @@ module.exports = (0, _flat.default)({
233
234
  recover: {
234
235
  button: "Renew",
235
236
  title: "Renew your subscription",
236
- description: "Your subscription will no longer be canceled, it will renew on {date}"
237
+ description: "Your subscription will not be canceled and will be automatically renewed on {date}, please confirm to continue"
237
238
  },
238
239
  changePlan: {
239
240
  button: "Update",
package/lib/locales/zh.js CHANGED
@@ -94,7 +94,8 @@ module.exports = (0, _flat.default)({
94
94
  recoverFrom: "\u6062\u590D\u81EA",
95
95
  quantityLimitPerCheckout: "\u8D85\u51FA\u8D2D\u4E70\u9650\u5236",
96
96
  quantityNotEnough: "\u5E93\u5B58\u4E0D\u8DB3",
97
- amountPrecisionLimit: "\u91D1\u989D\u5C0F\u6570\u4F4D\u6570\u5FC5\u987B\u5728 {precision} \u4F4D\u4EE5\u5185"
97
+ amountPrecisionLimit: "\u91D1\u989D\u5C0F\u6570\u4F4D\u6570\u5FC5\u987B\u5728 {precision} \u4F4D\u4EE5\u5185",
98
+ saveAsDefaultPriceSuccess: "\u8BBE\u7F6E\u9ED8\u8BA4\u4EF7\u683C\u6210\u529F"
98
99
  },
99
100
  payment: {
100
101
  checkout: {
@@ -117,9 +118,9 @@ module.exports = (0, _flat.default)({
117
118
  subscription: "\u67E5\u770B\u8BA2\u9605",
118
119
  invoice: "\u67E5\u770B\u8D26\u5355"
119
120
  },
120
- paymentRequired: "\u652F\u4ED8\u6570\u91CF",
121
+ paymentRequired: "\u652F\u4ED8\u91D1\u989D",
121
122
  staking: {
122
- title: "\u8D28\u62BC\u6570\u91CF",
123
+ title: "\u8D28\u62BC\u91D1\u989D",
123
124
  tooltip: "\u8D28\u62BC\u76F8\u5F53\u4E8E\u4FDD\u8BC1\u91D1\uFF0C\u7528\u4E8E\u786E\u4FDD\u672A\u6765\u7684\u8D26\u5355\u80FD\u591F\u6B63\u5E38\u6263\u6B3E\uFF0C\u5982\u679C\u4F60\u4ECE DID Wallet \u64A4\u9500\u8D28\u62BC\uFF0C\u8BA2\u9605\u4E5F\u4F1A\u88AB\u53D6\u6D88\u3002"
124
125
  },
125
126
  stakingConfirm: "\u5728\u6B64\u652F\u4ED8\u4E2D\uFF0C\u8D28\u62BC\u91D1\u989D\u4E0E\u4EA7\u54C1\u8D39\u7528\u5206\u5F00",
@@ -200,7 +201,7 @@ module.exports = (0, _flat.default)({
200
201
  invoices: "\u8D26\u5355\u5386\u53F2",
201
202
  details: "\u8D26\u6237\u8BE6\u60C5",
202
203
  summary: "\u8BA1\u8D39\u6458\u8981",
203
- specifics: "\u5177\u4F53\u4FE1\u606F",
204
+ products: "\u4EA7\u54C1\u4FE1\u606F",
204
205
  update: "\u66F4\u65B0\u5BA2\u6237\u4FE1\u606F",
205
206
  empty: "\u770B\u8D77\u6765\u60A8\u5728\u8FD9\u91CC\u6CA1\u6709\u4EFB\u4F55\u8BA2\u9605\u6216\u652F\u4ED8",
206
207
  cancel: {
@@ -233,7 +234,7 @@ module.exports = (0, _flat.default)({
233
234
  recover: {
234
235
  button: "\u7EED\u8BA2",
235
236
  title: "\u7EED\u8BA2\u60A8\u7684\u8BA2\u9605",
236
- description: "\u60A8\u7684\u8BA2\u9605\u5C06\u4E0D\u518D\u88AB\u53D6\u6D88\uFF0C\u5C06\u5728{date}\u7EED\u8BA2"
237
+ description: "\u60A8\u7684\u8BA2\u9605\u5C06\u4E0D\u4F1A\u88AB\u53D6\u6D88\uFF0C\u5E76\u5C06\u5728{date}\u81EA\u52A8\u7EED\u8BA2\uFF0C\u8BF7\u786E\u8BA4\u662F\u5426\u7EE7\u7EED"
237
238
  },
238
239
  changePlan: {
239
240
  button: "\u66F4\u65B0",
@@ -52,6 +52,10 @@ function AddressForm({
52
52
  InputProps: {
53
53
  startAdornment: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.InputAdornment, {
54
54
  position: "start",
55
+ style: {
56
+ marginRight: "2px",
57
+ marginLeft: "-8px"
58
+ },
55
59
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
56
60
  name: "billing_address.country",
57
61
  control,
@@ -6,7 +6,7 @@ type Props = CheckoutContext & CheckoutCallbacks & {
6
6
  error?: any;
7
7
  showCheckoutSummary?: boolean;
8
8
  };
9
- declare function Payment({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, completed, mode, onPaid, onError, onChange, goBack, action, showCheckoutSummary, }: Props): import("react").JSX.Element;
9
+ declare function Payment({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, completed, error, mode, onPaid, onError, onChange, goBack, action, showCheckoutSummary, }: Props): import("react").JSX.Element;
10
10
  declare namespace Payment {
11
11
  var defaultProps: {
12
12
  completed: boolean;
@@ -262,7 +262,7 @@ function Payment({
262
262
  paymentLink,
263
263
  customer,
264
264
  completed,
265
- // error,
265
+ error,
266
266
  mode,
267
267
  onPaid,
268
268
  onError,
@@ -297,6 +297,13 @@ function Payment({
297
297
  }
298
298
  }, [checkoutSession, livemode, setLivemode, refresh]);
299
299
  const renderContent = () => {
300
+ if (error) {
301
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_error.default, {
302
+ mode,
303
+ title: "Oops",
304
+ description: (0, _util2.formatError)(error)
305
+ });
306
+ }
300
307
  if (!checkoutSession || !delay) {
301
308
  return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
302
309
  className: "cko-container",
@@ -56,7 +56,7 @@ function ProductCard({
56
56
  sx: {
57
57
  fontWeight: 500,
58
58
  mb: 0.5,
59
- lineHeight: 1,
59
+ lineHeight: 1.2,
60
60
  fontSize: 16
61
61
  },
62
62
  color: "text.primary",
@@ -67,7 +67,7 @@ function ProductCard({
67
67
  sx: {
68
68
  fontSize: "0.85rem",
69
69
  mb: 0.5,
70
- lineHeight: 1,
70
+ lineHeight: 1.2,
71
71
  textAlign: "left"
72
72
  },
73
73
  color: "text.lighter",
@@ -11,21 +11,23 @@ function OverviewSkeleton() {
11
11
  in: true,
12
12
  children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
13
13
  direction: "column",
14
- children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
14
+ children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
15
15
  direction: "row",
16
16
  alignItems: "center",
17
17
  spacing: 2,
18
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
19
- variant: "circular",
20
- width: 32,
21
- height: 32
22
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
18
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
23
19
  variant: "text",
24
20
  sx: {
25
21
  fontSize: "2rem",
26
22
  width: "40%"
27
23
  }
28
- })]
24
+ })
25
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
26
+ sx: {
27
+ mt: 2
28
+ },
29
+ variant: "rounded",
30
+ height: 100
29
31
  }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
30
32
  mt: 2,
31
33
  component: "div",
@@ -35,13 +37,6 @@ function OverviewSkeleton() {
35
37
  component: "div",
36
38
  variant: "h2",
37
39
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {})
38
- }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
39
- sx: {
40
- mt: 2
41
- },
42
- variant: "rounded",
43
- width: 200,
44
- height: 200
45
40
  })]
46
41
  })
47
42
  });
@@ -11,38 +11,46 @@ function PaymentSkeleton() {
11
11
  in: true,
12
12
  children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
13
13
  direction: "column",
14
- spacing: 2,
15
14
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
16
15
  variant: "text",
17
16
  sx: {
18
17
  fontSize: "2rem",
19
18
  width: "40%"
20
19
  }
20
+ }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
21
+ sx: {
22
+ mt: 2
23
+ },
24
+ variant: "rounded",
25
+ height: 68
21
26
  }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
27
+ mt: 1,
22
28
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
23
29
  component: "div",
24
30
  variant: "h4",
31
+ mb: -1,
25
32
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {})
26
33
  }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
27
34
  component: "div",
28
- variant: "h1",
29
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {})
35
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
36
+ height: 60
37
+ })
30
38
  })]
31
39
  }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
32
40
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
33
41
  component: "div",
34
42
  variant: "h4",
43
+ mb: -1,
35
44
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {})
36
45
  }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
37
46
  component: "div",
38
- variant: "h1",
39
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {})
47
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
48
+ height: 60
49
+ })
40
50
  })]
41
51
  }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
42
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
43
- component: "div",
44
- variant: "h4",
45
- children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {})
52
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Skeleton, {
53
+ height: 60
46
54
  })
47
55
  })]
48
56
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/payment-react",
3
- "version": "1.14.27",
3
+ "version": "1.14.29",
4
4
  "description": "Reusable react components for payment kit v2",
5
5
  "keywords": [
6
6
  "react",
@@ -93,7 +93,7 @@
93
93
  "@babel/core": "^7.25.2",
94
94
  "@babel/preset-env": "^7.25.2",
95
95
  "@babel/preset-react": "^7.24.7",
96
- "@blocklet/payment-types": "1.14.27",
96
+ "@blocklet/payment-types": "1.14.29",
97
97
  "@storybook/addon-essentials": "^7.6.20",
98
98
  "@storybook/addon-interactions": "^7.6.20",
99
99
  "@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": "8a67ed1dbdda51526d4cd03c9c10c6930a9ac6a0"
126
+ "gitHead": "104f4189d9ef96c1e332ffa90824ebd3063c989d"
127
127
  }
@@ -85,7 +85,7 @@ export default function CheckoutForm({
85
85
  paymentLink={data?.paymentLink}
86
86
  customer={data?.customer}
87
87
  completed={state.completed}
88
- error={apiError || state.appError}
88
+ error={apiError}
89
89
  onPaid={handlePaid}
90
90
  onError={handleError}
91
91
  onChange={onChange}
@@ -106,7 +106,7 @@ export default function CheckoutForm({
106
106
  paymentLink={data?.paymentLink}
107
107
  customer={data?.customer}
108
108
  completed={state.completed}
109
- error={apiError || state.appError}
109
+ error={apiError}
110
110
  onPaid={handlePaid}
111
111
  onError={handleError}
112
112
  onChange={onChange}
@@ -127,7 +127,7 @@ export default function CheckoutForm({
127
127
  paymentLink={data?.paymentLink}
128
128
  customer={data?.customer}
129
129
  completed={state.completed}
130
- error={apiError || state.appError}
130
+ error={apiError}
131
131
  onPaid={handlePaid}
132
132
  onError={handleError}
133
133
  onChange={onChange}
@@ -83,16 +83,24 @@ function CheckoutTableInner({ id, mode, onPaid, onError, onChange, extraParams,
83
83
  if (!sessionId && !hashSessionId) {
84
84
  if (mode === 'standalone') {
85
85
  return (
86
- <Stack direction="column" alignItems="center">
86
+ <Stack direction="column" alignItems="center" p={2.5}>
87
87
  <Box
88
88
  sx={{
89
89
  display: 'flex',
90
90
  flexDirection: 'column',
91
91
  fontSize: '24px',
92
- margin: '20px 90px !important',
92
+ alignItems: 'center',
93
+ margin: {
94
+ xs: '20px 0',
95
+ md: '20px 20px',
96
+ },
97
+ maxWidth: {
98
+ xs: '100%',
99
+ md: 400,
100
+ },
93
101
  textAlign: 'center',
94
102
  }}>
95
- {!data.livemode && <Livemode sx={{ display: 'flex', marginBottom: '8px' }} />}
103
+ {!data.livemode && <Livemode sx={{ display: 'flex', marginBottom: '8px', width: 'fit-content' }} />}
96
104
  <Typography
97
105
  color="text.primary"
98
106
  fontWeight={600}
@@ -16,7 +16,7 @@ export default function Livemode({ color, backgroundColor, sx }: Props) {
16
16
  sx={{
17
17
  ml: 2,
18
18
  height: 18,
19
- lineHeight: 1,
19
+ lineHeight: 1.2,
20
20
  textTransform: 'uppercase',
21
21
  fontSize: '0.8rem',
22
22
  fontWeight: 'bold',