@blocklet/payment-react 1.18.56 → 1.19.1

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 (251) hide show
  1. package/es/checkout/donate.d.ts +1 -15
  2. package/es/checkout/donate.js +301 -189
  3. package/es/checkout/form.d.ts +1 -15
  4. package/es/checkout/form.js +5 -13
  5. package/es/checkout/table.js +3 -3
  6. package/es/components/blockchain/gas.d.ts +1 -5
  7. package/es/components/blockchain/gas.js +10 -2
  8. package/es/components/blockchain/tx.d.ts +1 -8
  9. package/es/components/blockchain/tx.js +29 -10
  10. package/es/components/confirm.d.ts +1 -10
  11. package/es/components/confirm.js +4 -10
  12. package/es/components/country-select.d.ts +3 -2
  13. package/es/components/country-select.js +375 -352
  14. package/es/components/date-range-picker.d.ts +13 -0
  15. package/es/components/date-range-picker.js +279 -0
  16. package/es/components/input.d.ts +14 -20
  17. package/es/components/input.js +51 -44
  18. package/es/components/label.d.ts +7 -0
  19. package/es/components/label.js +49 -0
  20. package/es/components/lazy-loader.js +1 -2
  21. package/es/components/link.d.ts +2 -9
  22. package/es/components/link.js +9 -6
  23. package/es/components/livemode.d.ts +2 -8
  24. package/es/components/livemode.js +1 -5
  25. package/es/components/loading-button.d.ts +6 -1
  26. package/es/components/loading-button.js +56 -66
  27. package/es/components/over-due-invoice-payment.d.ts +0 -18
  28. package/es/components/over-due-invoice-payment.js +138 -95
  29. package/es/components/payment-beneficiaries.d.ts +2 -7
  30. package/es/components/payment-beneficiaries.js +86 -40
  31. package/es/components/pricing-item.d.ts +0 -5
  32. package/es/components/pricing-item.js +1 -4
  33. package/es/components/pricing-table.d.ts +2 -10
  34. package/es/components/pricing-table.js +8 -7
  35. package/es/components/resume-subscription.d.ts +0 -10
  36. package/es/components/resume-subscription.js +42 -21
  37. package/es/components/truncated-text.d.ts +2 -9
  38. package/es/components/truncated-text.js +0 -5
  39. package/es/contexts/donate.d.ts +0 -7
  40. package/es/contexts/donate.js +10 -8
  41. package/es/contexts/payment.d.ts +1 -4
  42. package/es/contexts/payment.js +7 -2
  43. package/es/history/credit/grants-list.d.ts +14 -0
  44. package/es/history/credit/grants-list.js +215 -0
  45. package/es/history/credit/transactions-list.d.ts +13 -0
  46. package/es/history/credit/transactions-list.js +255 -0
  47. package/es/history/invoice/list.d.ts +2 -18
  48. package/es/history/invoice/list.js +172 -74
  49. package/es/history/payment/list.js +115 -38
  50. package/es/hooks/keyboard.d.ts +1 -1
  51. package/es/hooks/keyboard.js +2 -4
  52. package/es/index.d.ts +5 -1
  53. package/es/index.js +10 -1
  54. package/es/libs/cached-request.js +2 -4
  55. package/es/libs/phone-validator.js +1 -2
  56. package/es/libs/util.d.ts +2 -0
  57. package/es/libs/util.js +14 -4
  58. package/es/libs/validator.js +2 -4
  59. package/es/locales/en.js +20 -2
  60. package/es/locales/zh.js +20 -2
  61. package/es/payment/amount.d.ts +2 -7
  62. package/es/payment/amount.js +1 -5
  63. package/es/payment/donation-form.d.ts +2 -10
  64. package/es/payment/donation-form.js +196 -160
  65. package/es/payment/error.d.ts +2 -8
  66. package/es/payment/error.js +40 -20
  67. package/es/payment/footer.d.ts +2 -3
  68. package/es/payment/footer.js +19 -6
  69. package/es/payment/form/addon.js +14 -4
  70. package/es/payment/form/address.d.ts +2 -9
  71. package/es/payment/form/address.js +3 -6
  72. package/es/payment/form/currency.js +45 -25
  73. package/es/payment/form/index.d.ts +2 -8
  74. package/es/payment/form/index.js +151 -71
  75. package/es/payment/form/phone.js +2 -4
  76. package/es/payment/form/stripe/form.d.ts +2 -8
  77. package/es/payment/form/stripe/form.js +1 -3
  78. package/es/payment/header.js +38 -16
  79. package/es/payment/index.d.ts +2 -9
  80. package/es/payment/index.js +23 -17
  81. package/es/payment/product-card.d.ts +2 -11
  82. package/es/payment/product-card.js +84 -50
  83. package/es/payment/product-donation.js +175 -114
  84. package/es/payment/product-item.d.ts +9 -9
  85. package/es/payment/product-item.js +320 -145
  86. package/es/payment/product-skeleton.js +2 -2
  87. package/es/payment/skeleton/donation.js +27 -7
  88. package/es/payment/skeleton/overview.js +22 -2
  89. package/es/payment/skeleton/payment.js +33 -5
  90. package/es/payment/success.d.ts +2 -9
  91. package/es/payment/success.js +41 -14
  92. package/es/payment/summary.d.ts +4 -17
  93. package/es/payment/summary.js +193 -111
  94. package/es/theme/index.d.ts +0 -5
  95. package/es/theme/index.js +2 -5
  96. package/es/theme/typography.d.ts +2 -2
  97. package/lib/checkout/donate.d.ts +1 -15
  98. package/lib/checkout/donate.js +75 -54
  99. package/lib/checkout/form.d.ts +1 -15
  100. package/lib/checkout/form.js +7 -15
  101. package/lib/checkout/table.js +4 -4
  102. package/lib/components/blockchain/gas.d.ts +1 -5
  103. package/lib/components/blockchain/gas.js +3 -2
  104. package/lib/components/blockchain/tx.d.ts +1 -8
  105. package/lib/components/blockchain/tx.js +15 -10
  106. package/lib/components/confirm.d.ts +1 -10
  107. package/lib/components/confirm.js +5 -11
  108. package/lib/components/country-select.d.ts +3 -2
  109. package/lib/components/country-select.js +23 -22
  110. package/lib/components/date-range-picker.d.ts +13 -0
  111. package/lib/components/date-range-picker.js +329 -0
  112. package/lib/components/input.d.ts +14 -20
  113. package/lib/components/input.js +28 -27
  114. package/lib/components/label.d.ts +7 -0
  115. package/lib/components/label.js +60 -0
  116. package/lib/components/lazy-loader.js +1 -1
  117. package/lib/components/link.d.ts +2 -9
  118. package/lib/components/link.js +3 -8
  119. package/lib/components/livemode.d.ts +2 -8
  120. package/lib/components/livemode.js +3 -7
  121. package/lib/components/loading-button.d.ts +6 -1
  122. package/lib/components/loading-button.js +9 -17
  123. package/lib/components/over-due-invoice-payment.d.ts +0 -18
  124. package/lib/components/over-due-invoice-payment.js +31 -33
  125. package/lib/components/payment-beneficiaries.d.ts +2 -7
  126. package/lib/components/payment-beneficiaries.js +12 -11
  127. package/lib/components/pricing-item.d.ts +0 -5
  128. package/lib/components/pricing-item.js +2 -5
  129. package/lib/components/pricing-table.d.ts +2 -10
  130. package/lib/components/pricing-table.js +5 -11
  131. package/lib/components/resume-subscription.d.ts +0 -10
  132. package/lib/components/resume-subscription.js +16 -16
  133. package/lib/components/table.js +1 -1
  134. package/lib/components/truncated-text.d.ts +2 -9
  135. package/lib/components/truncated-text.js +1 -6
  136. package/lib/contexts/donate.d.ts +0 -7
  137. package/lib/contexts/donate.js +4 -7
  138. package/lib/contexts/payment.d.ts +1 -4
  139. package/lib/contexts/payment.js +4 -7
  140. package/lib/history/credit/grants-list.d.ts +14 -0
  141. package/lib/history/credit/grants-list.js +277 -0
  142. package/lib/history/credit/transactions-list.d.ts +13 -0
  143. package/lib/history/credit/transactions-list.js +301 -0
  144. package/lib/history/invoice/list.d.ts +2 -18
  145. package/lib/history/invoice/list.js +73 -37
  146. package/lib/history/payment/list.js +30 -16
  147. package/lib/hooks/keyboard.d.ts +1 -1
  148. package/lib/hooks/mobile.js +1 -1
  149. package/lib/hooks/subscription.js +1 -1
  150. package/lib/index.d.ts +5 -1
  151. package/lib/index.js +41 -2
  152. package/lib/libs/api.js +1 -1
  153. package/lib/libs/dayjs.js +1 -1
  154. package/lib/libs/phone-validator.js +0 -2
  155. package/lib/libs/theme.js +1 -1
  156. package/lib/libs/util.d.ts +2 -0
  157. package/lib/libs/util.js +15 -1
  158. package/lib/libs/validator.js +1 -1
  159. package/lib/locales/en.js +21 -3
  160. package/lib/locales/index.js +1 -1
  161. package/lib/locales/zh.js +21 -3
  162. package/lib/payment/amount.d.ts +2 -7
  163. package/lib/payment/amount.js +2 -6
  164. package/lib/payment/donation-form.d.ts +2 -10
  165. package/lib/payment/donation-form.js +33 -38
  166. package/lib/payment/error.d.ts +2 -8
  167. package/lib/payment/error.js +11 -13
  168. package/lib/payment/footer.d.ts +2 -3
  169. package/lib/payment/footer.js +5 -5
  170. package/lib/payment/form/addon.js +5 -3
  171. package/lib/payment/form/address.d.ts +2 -9
  172. package/lib/payment/form/address.js +5 -8
  173. package/lib/payment/form/currency.js +3 -3
  174. package/lib/payment/form/index.d.ts +2 -8
  175. package/lib/payment/form/index.js +64 -21
  176. package/lib/payment/form/phone.js +1 -1
  177. package/lib/payment/form/stripe/form.d.ts +2 -8
  178. package/lib/payment/form/stripe/form.js +3 -6
  179. package/lib/payment/header.js +8 -4
  180. package/lib/payment/index.d.ts +2 -9
  181. package/lib/payment/index.js +27 -18
  182. package/lib/payment/product-card.d.ts +2 -11
  183. package/lib/payment/product-card.js +13 -20
  184. package/lib/payment/product-donation.js +71 -66
  185. package/lib/payment/product-item.d.ts +9 -9
  186. package/lib/payment/product-item.js +168 -29
  187. package/lib/payment/product-skeleton.js +2 -2
  188. package/lib/payment/skeleton/donation.js +8 -4
  189. package/lib/payment/skeleton/overview.js +6 -2
  190. package/lib/payment/skeleton/payment.js +9 -3
  191. package/lib/payment/success.d.ts +2 -9
  192. package/lib/payment/success.js +12 -15
  193. package/lib/payment/summary.d.ts +4 -17
  194. package/lib/payment/summary.js +53 -45
  195. package/lib/theme/index.d.ts +0 -5
  196. package/lib/theme/index.js +2 -5
  197. package/lib/theme/typography.d.ts +2 -2
  198. package/package.json +40 -40
  199. package/src/checkout/donate.tsx +103 -35
  200. package/src/checkout/form.tsx +5 -14
  201. package/src/checkout/table.tsx +3 -3
  202. package/src/components/blockchain/gas.tsx +5 -3
  203. package/src/components/blockchain/tx.tsx +19 -11
  204. package/src/components/confirm.tsx +4 -11
  205. package/src/components/country-select.tsx +391 -378
  206. package/src/components/date-range-picker.tsx +310 -0
  207. package/src/components/input.tsx +61 -46
  208. package/src/components/label.tsx +58 -0
  209. package/src/components/link.tsx +9 -7
  210. package/src/components/livemode.tsx +2 -6
  211. package/src/components/loading-button.tsx +63 -76
  212. package/src/components/over-due-invoice-payment.tsx +43 -28
  213. package/src/components/payment-beneficiaries.tsx +33 -14
  214. package/src/components/pricing-item.tsx +1 -4
  215. package/src/components/pricing-table.tsx +8 -8
  216. package/src/components/resume-subscription.tsx +20 -14
  217. package/src/components/table.tsx +2 -2
  218. package/src/components/truncated-text.tsx +0 -6
  219. package/src/contexts/donate.tsx +6 -7
  220. package/src/contexts/payment.tsx +7 -3
  221. package/src/history/credit/grants-list.tsx +276 -0
  222. package/src/history/credit/transactions-list.tsx +317 -0
  223. package/src/history/invoice/list.tsx +92 -36
  224. package/src/history/payment/list.tsx +53 -16
  225. package/src/hooks/keyboard.ts +1 -1
  226. package/src/index.ts +9 -0
  227. package/src/libs/util.ts +14 -0
  228. package/src/locales/en.tsx +20 -0
  229. package/src/locales/zh.tsx +19 -0
  230. package/src/payment/amount.tsx +1 -6
  231. package/src/payment/donation-form.tsx +47 -29
  232. package/src/payment/error.tsx +16 -8
  233. package/src/payment/footer.tsx +11 -3
  234. package/src/payment/form/addon.tsx +6 -1
  235. package/src/payment/form/address.tsx +3 -7
  236. package/src/payment/form/currency.tsx +12 -2
  237. package/src/payment/form/index.tsx +121 -45
  238. package/src/payment/form/stripe/form.tsx +1 -5
  239. package/src/payment/header.tsx +14 -2
  240. package/src/payment/index.tsx +27 -22
  241. package/src/payment/product-card.tsx +41 -18
  242. package/src/payment/product-donation.tsx +85 -47
  243. package/src/payment/product-item.tsx +198 -28
  244. package/src/payment/product-skeleton.tsx +3 -2
  245. package/src/payment/skeleton/donation.tsx +12 -2
  246. package/src/payment/skeleton/overview.tsx +12 -2
  247. package/src/payment/skeleton/payment.tsx +16 -3
  248. package/src/payment/success.tsx +26 -15
  249. package/src/payment/summary.tsx +87 -44
  250. package/src/theme/index.tsx +5 -8
  251. package/src/theme/typography.ts +2 -2
@@ -24,7 +24,7 @@ var _livemode = _interopRequireDefault(require("../components/livemode"));
24
24
  var _payment = require("../contexts/payment");
25
25
  var _mobile = require("../hooks/mobile");
26
26
  var _loadingButton = _interopRequireDefault(require("../components/loading-button"));
27
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
28
28
  const ExpandMore = (0, _styles.styled)(props => {
29
29
  const {
30
30
  expand,
@@ -83,35 +83,24 @@ function getStakingSetup(items, currency, billingThreshold = 0) {
83
83
  }
84
84
  return "0";
85
85
  }
86
- PaymentSummary.defaultProps = {
87
- onUpsell: _noop.default,
88
- onDownsell: _noop.default,
89
- onApplyCrossSell: _noop.default,
90
- onCancelCrossSell: _noop.default,
91
- onChangeAmount: _noop.default,
92
- checkoutSessionId: "",
93
- crossSellBehavior: "",
94
- showStaking: false,
95
- donationSettings: null,
96
- action: "",
97
- trialEnd: 0
98
- };
99
86
  function PaymentSummary({
100
87
  items,
101
88
  currency,
102
89
  trialInDays,
103
90
  billingThreshold,
104
- onUpsell,
105
- onDownsell,
106
- onApplyCrossSell,
107
- onCancelCrossSell,
108
- onChangeAmount,
109
- checkoutSessionId,
110
- crossSellBehavior,
111
- showStaking,
112
- donationSettings,
113
- action,
91
+ onUpsell = _noop.default,
92
+ onDownsell = _noop.default,
93
+ onQuantityChange = _noop.default,
94
+ onApplyCrossSell = _noop.default,
95
+ onCancelCrossSell = _noop.default,
96
+ onChangeAmount = _noop.default,
97
+ checkoutSessionId = "",
98
+ crossSellBehavior = "",
99
+ showStaking = false,
100
+ donationSettings = void 0,
101
+ action = "",
114
102
  trialEnd = 0,
103
+ completed = false,
115
104
  ...rest
116
105
  }) {
117
106
  const {
@@ -151,6 +140,10 @@ function PaymentSummary({
151
140
  await onUpsell(from, to);
152
141
  runAsync();
153
142
  };
143
+ const handleQuantityChange = async (itemId, quantity) => {
144
+ await onQuantityChange(itemId, quantity);
145
+ runAsync();
146
+ };
154
147
  const handleDownsell = async from => {
155
148
  await onDownsell(from);
156
149
  runAsync();
@@ -209,11 +202,14 @@ function PaymentSummary({
209
202
  currency,
210
203
  onUpsell: handleUpsell,
211
204
  onDownsell: handleDownsell,
205
+ adjustableQuantity: x.adjustable_quantity,
206
+ completed,
207
+ onQuantityChange: handleQuantityChange,
212
208
  children: x.cross_sell && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
213
209
  direction: "row",
214
- alignItems: "center",
215
- justifyContent: "space-between",
216
210
  sx: {
211
+ alignItems: "center",
212
+ justifyContent: "space-between",
217
213
  width: 1
218
214
  },
219
215
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {}), /* @__PURE__ */(0, _jsxRuntime.jsx)(_loadingButton.default, {
@@ -231,7 +227,9 @@ function PaymentSummary({
231
227
  }), data && items.some(x => x.price_id === data.id) === false && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Grow, {
232
228
  in: true,
233
229
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
234
- mt: 1,
230
+ sx: {
231
+ mt: 1
232
+ },
235
233
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_productItem.default, {
236
234
  item: {
237
235
  quantity: 1,
@@ -247,9 +245,9 @@ function PaymentSummary({
247
245
  onDownsell: _noop.default,
248
246
  children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
249
247
  direction: "row",
250
- alignItems: "center",
251
- justifyContent: "space-between",
252
248
  sx: {
249
+ alignItems: "center",
250
+ justifyContent: "space-between",
253
251
  width: 1
254
252
  },
255
253
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
@@ -283,9 +281,9 @@ function PaymentSummary({
283
281
  direction: "column",
284
282
  ...rest,
285
283
  children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
286
- display: "flex",
287
- alignItems: "center",
288
284
  sx: {
285
+ display: "flex",
286
+ alignItems: "center",
289
287
  mb: 2.5
290
288
  },
291
289
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
@@ -303,13 +301,15 @@ function PaymentSummary({
303
301
  }), !settings.livemode && /* @__PURE__ */(0, _jsxRuntime.jsx)(_livemode.default, {})]
304
302
  }), isMobile && !donationSettings ? /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
305
303
  children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
306
- justifyContent: "space-between",
307
- flexDirection: "row",
308
- alignItems: "center",
309
- mb: 1.5,
310
304
  onClick: () => setState({
311
305
  expanded: !state.expanded
312
306
  }),
307
+ sx: {
308
+ justifyContent: "space-between",
309
+ flexDirection: "row",
310
+ alignItems: "center",
311
+ mb: 1.5
312
+ },
313
313
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
314
314
  children: t("payment.checkout.productListTotal", {
315
315
  total: items.length
@@ -334,13 +334,17 @@ function PaymentSummary({
334
334
  }), staking > 0 && /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
335
335
  children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
336
336
  direction: "row",
337
- justifyContent: "space-between",
338
- alignItems: "center",
339
337
  spacing: 1,
338
+ sx: {
339
+ justifyContent: "space-between",
340
+ alignItems: "center"
341
+ },
340
342
  children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
341
343
  direction: "row",
342
- alignItems: "center",
343
344
  spacing: 0.5,
345
+ sx: {
346
+ alignItems: "center"
347
+ },
344
348
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
345
349
  sx: {
346
350
  color: "text.secondary"
@@ -364,13 +368,17 @@ function PaymentSummary({
364
368
  })]
365
369
  }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
366
370
  direction: "row",
367
- justifyContent: "space-between",
368
- alignItems: "center",
369
371
  spacing: 1,
372
+ sx: {
373
+ justifyContent: "space-between",
374
+ alignItems: "center"
375
+ },
370
376
  children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
371
377
  direction: "row",
372
- alignItems: "center",
373
378
  spacing: 0.5,
379
+ sx: {
380
+ alignItems: "center"
381
+ },
374
382
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
375
383
  sx: {
376
384
  color: "text.secondary"
@@ -394,11 +402,11 @@ function PaymentSummary({
394
402
  })]
395
403
  })]
396
404
  }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
397
- display: "flex",
398
- justifyContent: "space-between",
399
- flexDirection: "row",
400
- alignItems: "center",
401
405
  sx: {
406
+ display: "flex",
407
+ justifyContent: "space-between",
408
+ flexDirection: "row",
409
+ alignItems: "center",
402
410
  width: "100%"
403
411
  },
404
412
  children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
@@ -7,9 +7,4 @@ export declare function PaymentThemeProvider({ children, theme: customTheme, }:
7
7
  children: React.ReactNode;
8
8
  theme?: PaymentThemeOptions;
9
9
  }): JSX.Element;
10
- export declare namespace PaymentThemeProvider {
11
- var defaultProps: {
12
- theme: {};
13
- };
14
- }
15
10
  export { typography };
@@ -19,9 +19,6 @@ var _react = require("react");
19
19
  require("./index.css");
20
20
  require("./types");
21
21
  var _typography = require("./typography");
22
- PaymentThemeProvider.defaultProps = {
23
- theme: {}
24
- };
25
22
  function PaymentThemeProvider({
26
23
  children,
27
24
  theme: customTheme = {}
@@ -277,7 +274,7 @@ function PaymentThemeProvider({
277
274
  backgroundColor: palette.chip.default.background,
278
275
  borderColor: palette.chip.default.border
279
276
  },
280
- "&.MuiChip-filledSecondary": {
277
+ "&.MuiChip-filled.MuiChip-colorSecondary": {
281
278
  color: palette.chip.secondary.text,
282
279
  backgroundColor: palette.chip.secondary.background,
283
280
  borderColor: palette.chip.secondary.border
@@ -292,7 +289,7 @@ function PaymentThemeProvider({
292
289
  backgroundColor: palette.chip.warning.background,
293
290
  borderColor: palette.chip.warning.border
294
291
  },
295
- "&.MuiChip-filledPrimary,&.MuiChip-filledInfo": {
292
+ "&.MuiChip-filled.MuiChip-colorPrimary,&.MuiChip-filledInfo": {
296
293
  color: palette.chip.info.text,
297
294
  backgroundColor: palette.chip.info.background,
298
295
  borderColor: palette.chip.info.border
@@ -1,2 +1,2 @@
1
- import type { TypographyOptions } from '@mui/material/styles/createTypography';
2
- export declare const typography: TypographyOptions;
1
+ import type { TypographyStyleOptions } from '@mui/material/styles/createTypography';
2
+ export declare const typography: TypographyStyleOptions;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/payment-react",
3
- "version": "1.18.56",
3
+ "version": "1.19.1",
4
4
  "description": "Reusable react components for payment kit v2",
5
5
  "keywords": [
6
6
  "react",
@@ -54,76 +54,76 @@
54
54
  }
55
55
  },
56
56
  "dependencies": {
57
- "@arcblock/did-connect": "^2.13.66",
58
- "@arcblock/ux": "^2.13.66",
57
+ "@arcblock/did-connect": "^3.0.1",
58
+ "@arcblock/ux": "^3.0.1",
59
59
  "@arcblock/ws": "^1.20.14",
60
- "@blocklet/theme": "^2.13.66",
61
- "@blocklet/ui-react": "^2.13.66",
62
- "@mui/icons-material": "^5.16.6",
63
- "@mui/lab": "^5.0.0-alpha.173",
64
- "@mui/material": "^5.16.6",
65
- "@mui/system": "^5.16.6",
60
+ "@blocklet/theme": "^3.0.1",
61
+ "@blocklet/ui-react": "^3.0.1",
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",
66
66
  "@ocap/util": "^1.20.14",
67
- "@stripe/react-stripe-js": "^2.7.3",
67
+ "@stripe/react-stripe-js": "^2.9.0",
68
68
  "@stripe/stripe-js": "^2.4.0",
69
- "@vitejs/plugin-legacy": "^5.4.1",
70
- "ahooks": "^3.8.0",
71
- "axios": "^1.7.5",
72
- "dayjs": "^1.11.12",
69
+ "@vitejs/plugin-legacy": "^7.0.0",
70
+ "ahooks": "^3.8.5",
71
+ "axios": "^1.10.0",
72
+ "dayjs": "^1.11.13",
73
73
  "flat": "^5.0.2",
74
- "google-libphonenumber": "^3.2.38",
74
+ "google-libphonenumber": "^3.2.42",
75
75
  "lodash": "^4.17.21",
76
76
  "numbro": "^2.5.0",
77
- "p-wait-for": "3",
78
- "react-error-boundary": "^4.0.13",
79
- "react-hook-form": "^7.52.1",
77
+ "p-wait-for": "^3.2.0",
78
+ "react-error-boundary": "^4.1.2",
79
+ "react-hook-form": "^7.58.1",
80
80
  "react-international-phone": "^3.1.2",
81
81
  "ufo": "^1.6.1",
82
82
  "use-bus": "^2.5.2",
83
- "validator": "^13.12.0"
83
+ "validator": "^13.15.15"
84
84
  },
85
85
  "peerDependencies": {
86
- "react": ">=18.1.0"
86
+ "react": "^19.1.0"
87
87
  },
88
88
  "publishConfig": {
89
89
  "access": "public"
90
90
  },
91
91
  "devDependencies": {
92
92
  "@arcblock/eslint-config-ts": "^0.3.3",
93
- "@babel/cli": "^7.24.8",
94
- "@babel/core": "^7.25.2",
95
- "@babel/preset-env": "^7.25.2",
96
- "@babel/preset-react": "^7.24.7",
97
- "@blocklet/payment-types": "1.18.56",
93
+ "@babel/cli": "^7.27.2",
94
+ "@babel/core": "^7.27.4",
95
+ "@babel/preset-env": "^7.27.2",
96
+ "@babel/preset-react": "^7.27.1",
97
+ "@blocklet/payment-types": "1.19.1",
98
98
  "@storybook/addon-essentials": "^7.6.20",
99
99
  "@storybook/addon-interactions": "^7.6.20",
100
100
  "@storybook/addon-links": "^7.6.20",
101
101
  "@storybook/addon-onboarding": "^1.0.11",
102
102
  "@storybook/blocks": "^7.6.20",
103
103
  "@storybook/react": "^7.6.20",
104
- "@storybook/react-vite": "^7.6.20",
104
+ "@storybook/react-vite": "^9.0.13",
105
105
  "@storybook/test": "^7.6.20",
106
- "@types/react": "^18.3.3",
107
- "@types/react-dom": "^18.3.0",
108
- "@vitejs/plugin-legacy": "^5.4.1",
106
+ "@types/react": "^18.3.23",
107
+ "@types/react-dom": "^18.3.7",
108
+ "@vitejs/plugin-legacy": "^7.0.0",
109
109
  "copyfiles": "^2.4.1",
110
- "eslint": "^8.57.0",
110
+ "eslint": "^8.57.1",
111
111
  "glob": "^10.4.5",
112
112
  "import-sort-style-module": "^6.0.0",
113
113
  "jest": "^29.7.0",
114
- "prettier": "^3.3.3",
114
+ "prettier": "^3.6.0",
115
115
  "prettier-plugin-import-sort": "^0.0.7",
116
- "react": "18.2.0",
117
- "react-dom": "18.2.0",
116
+ "react": "^19.1.0",
117
+ "react-dom": "^19.1.0",
118
118
  "rollup-plugin-node-builtins": "^2.1.2",
119
119
  "storybook": "^7.6.20",
120
- "ts-jest": "^29.2.5",
121
- "type-fest": "^4.23.0",
122
- "typescript": "^5.5.4",
120
+ "ts-jest": "^29.4.0",
121
+ "type-fest": "^4.41.0",
122
+ "typescript": "5.5.4",
123
123
  "unbuild": "^2.0.0",
124
- "vite": "^5.3.5",
125
- "vite-plugin-babel": "^1.2.0",
126
- "vite-plugin-node-polyfills": "^0.21.0"
124
+ "vite": "^7.0.0",
125
+ "vite-plugin-babel": "^1.3.1",
126
+ "vite-plugin-node-polyfills": "^0.23.0"
127
127
  },
128
- "gitHead": "9fd0235186e07388337cf1a57b257f97de8dd4c3"
128
+ "gitHead": "48d5719c8ce4e89a16f8dd576ff8f72072e3909e"
129
129
  }
@@ -183,9 +183,9 @@ export function DonateDetails({ supporters = [], currency, method }: DonateHisto
183
183
  }}>
184
184
  <Stack
185
185
  direction="row"
186
- alignItems="center"
187
186
  spacing={0.5}
188
187
  sx={{
188
+ alignItems: 'center',
189
189
  flex: 3,
190
190
  overflow: 'hidden',
191
191
  }}>
@@ -226,7 +226,14 @@ export function DonateDetails({ supporters = [], currency, method }: DonateHisto
226
226
  {x.customer?.name}
227
227
  </Typography>
228
228
  </Stack>
229
- <Stack direction="row" alignItems="center" justifyContent="flex-end" spacing={0.5} sx={{ flex: 1 }}>
229
+ <Stack
230
+ direction="row"
231
+ spacing={0.5}
232
+ sx={{
233
+ alignItems: 'center',
234
+ justifyContent: 'flex-end',
235
+ flex: 1,
236
+ }}>
230
237
  <Avatar
231
238
  key={x.id}
232
239
  src={currency?.logo}
@@ -256,7 +263,12 @@ function SupporterAvatar({
256
263
  const customersNum = customers.length;
257
264
  if (customersNum === 0) return null;
258
265
  return (
259
- <Stack flexDirection="row" justifyContent="center" alignItems="center">
266
+ <Stack
267
+ sx={{
268
+ flexDirection: 'row',
269
+ justifyContent: 'center',
270
+ alignItems: 'center',
271
+ }}>
260
272
  <AvatarGroup
261
273
  max={5}
262
274
  sx={{
@@ -336,7 +348,13 @@ function SupporterTable({ supporters = [], totalAmount = '0', currency, method }
336
348
  const customersNum = customers.length;
337
349
  if (customersNum === 0) return null;
338
350
  return (
339
- <Box display="flex" flexDirection="column" alignItems="center" gap={{ xs: 0.5, sm: 1 }}>
351
+ <Box
352
+ sx={{
353
+ display: 'flex',
354
+ flexDirection: 'column',
355
+ alignItems: 'center',
356
+ gap: { xs: 0.5, sm: 1 },
357
+ }}>
340
358
  <SupporterAvatar supporters={supporters} totalAmount={totalAmount} currency={currency} method={method} />
341
359
  <DonateDetails supporters={supporters} totalAmount={totalAmount} currency={currency} method={method} />
342
360
  </Box>
@@ -351,14 +369,21 @@ function SupporterSimple({ supporters = [], totalAmount = '0', currency, method
351
369
 
352
370
  return (
353
371
  <Box
354
- display="flex"
355
- flexDirection="column"
356
- alignItems="center"
357
- gap={{
358
- xs: 0.5,
359
- sm: 1,
372
+ sx={{
373
+ display: 'flex',
374
+ flexDirection: 'column',
375
+ alignItems: 'center',
376
+
377
+ gap: {
378
+ xs: 0.5,
379
+ sm: 1,
380
+ },
360
381
  }}>
361
- <Typography component="p" color="text.secondary">
382
+ <Typography
383
+ component="p"
384
+ sx={{
385
+ color: 'text.secondary',
386
+ }}>
362
387
  {customersNum === 0 ? (
363
388
  <span style={emojiFont}>{t('payment.checkout.donation.empty')}</span>
364
389
  ) : (
@@ -550,7 +575,12 @@ function CheckoutDonateInner({
550
575
  variant={(donateSettings.appearance?.button?.variant || 'contained') as any}
551
576
  {...donateSettings.appearance?.button}
552
577
  onClick={handlePopoverOpen}>
553
- <Stack direction="row" alignItems="center" spacing={0.5}>
578
+ <Stack
579
+ direction="row"
580
+ spacing={0.5}
581
+ sx={{
582
+ alignItems: 'center',
583
+ }}>
554
584
  {donateSettings.appearance.button.icon}
555
585
  {typeof donateSettings.appearance.button.text === 'string' ? (
556
586
  <Typography sx={{ whiteSpace: 'nowrap' }}>{donateSettings.appearance.button.text}</Typography>
@@ -594,9 +624,20 @@ function CheckoutDonateInner({
594
624
  <CircularProgress />
595
625
  </div>
596
626
  )}
597
- <Box display="flex" alignItems="center" flexDirection="column" gap={2}>
627
+ <Box
628
+ sx={{
629
+ display: 'flex',
630
+ alignItems: 'center',
631
+ flexDirection: 'column',
632
+ gap: 2,
633
+ }}>
598
634
  <Button {...inlineOptions.button} onClick={() => startDonate()}>
599
- <Stack direction="row" alignItems="center" spacing={0.5}>
635
+ <Stack
636
+ direction="row"
637
+ spacing={0.5}
638
+ sx={{
639
+ alignItems: 'center',
640
+ }}>
600
641
  {inlineOptions?.button?.icon}
601
642
  {typeof inlineText === 'string' ? (
602
643
  <Typography sx={{ whiteSpace: 'nowrap' }}>{inlineText}</Typography>
@@ -613,11 +654,15 @@ function CheckoutDonateInner({
613
654
  );
614
655
  const defaultRender = (
615
656
  <Box
616
- sx={{ width: '100%', minWidth: 300, maxWidth: 720 }}
617
- display="flex"
618
- flexDirection="column"
619
- alignItems="center"
620
- gap={{ xs: 1, sm: 2 }}>
657
+ sx={{
658
+ display: 'flex',
659
+ flexDirection: 'column',
660
+ alignItems: 'center',
661
+ gap: { xs: 1, sm: 2 },
662
+ width: '100%',
663
+ minWidth: 300,
664
+ maxWidth: 720,
665
+ }}>
621
666
  <Button
622
667
  size={(donateSettings.appearance?.button?.size || 'medium') as any}
623
668
  color={(donateSettings.appearance?.button?.color || 'primary') as any}
@@ -634,7 +679,12 @@ function CheckoutDonateInner({
634
679
  }}
635
680
  {...donateSettings.appearance?.button}
636
681
  onClick={() => startDonate()}>
637
- <Stack direction="row" alignItems="center" spacing={0.5}>
682
+ <Stack
683
+ direction="row"
684
+ spacing={0.5}
685
+ sx={{
686
+ alignItems: 'center',
687
+ }}>
638
688
  {donateSettings.appearance.button.icon && (
639
689
  <Typography sx={{ mr: 0.5, display: 'inline-flex', alignItems: 'center' }}>
640
690
  {donateSettings.appearance.button.icon}
@@ -692,7 +742,12 @@ function CheckoutDonateInner({
692
742
  <Dialog
693
743
  open={state.open}
694
744
  title={
695
- <Box display="flex" alignItems="center" gap={0.5}>
745
+ <Box
746
+ sx={{
747
+ display: 'flex',
748
+ alignItems: 'center',
749
+ gap: 0.5,
750
+ }}>
696
751
  <Typography variant="h3" sx={{ maxWidth: 320, textOverflow: 'ellipsis', overflow: 'hidden' }}>
697
752
  {donateSettings.title}
698
753
  </Typography>
@@ -714,7 +769,13 @@ function CheckoutDonateInner({
714
769
  maxWidth="md"
715
770
  toolbar={
716
771
  isMobile ? null : (
717
- <Box display="flex" alignItems="center" gap={1} sx={{ color: 'text.secondary' }}>
772
+ <Box
773
+ sx={{
774
+ display: 'flex',
775
+ alignItems: 'center',
776
+ gap: 1,
777
+ color: 'text.secondary',
778
+ }}>
718
779
  <AvatarGroup
719
780
  total={customers?.length}
720
781
  max={5}
@@ -801,28 +862,35 @@ function CheckoutDonateInner({
801
862
  );
802
863
  }
803
864
 
804
- export default function CheckoutDonate(props: DonateProps) {
865
+ export default function CheckoutDonate(rawProps: DonateProps) {
866
+ const props = Object.assign(
867
+ {
868
+ theme: 'default',
869
+ livemode: undefined,
870
+ inlineOptions: {
871
+ button: {
872
+ text: 'Tip',
873
+ },
874
+ },
875
+ timeout: 5000,
876
+ mode: 'default',
877
+ },
878
+ rawProps
879
+ );
880
+
805
881
  const { livemode } = usePaymentContext();
806
882
  const content = (
883
+ // eslint-disable-next-line react/prop-types
807
884
  <CheckoutDonateInner {...props} livemode={props.livemode === undefined ? livemode : props.livemode} />
808
885
  );
886
+ // eslint-disable-next-line react/prop-types
809
887
  if (props.theme === 'inherit') {
810
888
  return content;
811
889
  }
890
+ // eslint-disable-next-line react/prop-types
812
891
  if (props.theme && typeof props.theme === 'object') {
892
+ // eslint-disable-next-line react/prop-types
813
893
  return <PaymentThemeProvider theme={props.theme}>{content}</PaymentThemeProvider>;
814
894
  }
815
895
  return <PaymentThemeProvider>{content}</PaymentThemeProvider>;
816
896
  }
817
-
818
- CheckoutDonate.defaultProps = {
819
- theme: 'default',
820
- livemode: undefined,
821
- timeout: 5000,
822
- mode: 'default',
823
- inlineOptions: {
824
- button: {
825
- text: 'Tip',
826
- },
827
- },
828
- };
@@ -34,13 +34,13 @@ const fetchCheckoutSession = async (id: string): Promise<CheckoutContext> => {
34
34
 
35
35
  export default function CheckoutForm({
36
36
  id,
37
- mode,
38
- onPaid,
39
- onError,
37
+ mode = 'inline',
38
+ onPaid = noop,
39
+ onError = console.error,
40
40
  onChange,
41
41
  goBack,
42
- extraParams,
43
- action,
42
+ extraParams = {},
43
+ action = '',
44
44
  theme = 'default',
45
45
  formType = 'payment',
46
46
  ...restProps
@@ -124,12 +124,3 @@ export default function CheckoutForm({
124
124
  }
125
125
  return <PaymentThemeProvider>{Checkout}</PaymentThemeProvider>;
126
126
  }
127
-
128
- CheckoutForm.defaultProps = {
129
- onPaid: noop,
130
- onError: console.error,
131
- mode: 'inline',
132
- action: '',
133
- extraParams: {},
134
- formType: 'payment',
135
- };
@@ -91,8 +91,8 @@ function CheckoutTableInner({ id, mode, onPaid, onError, onChange, extraParams,
91
91
  return (
92
92
  <Stack
93
93
  direction="column"
94
- alignItems="center"
95
94
  sx={{
95
+ alignItems: 'center',
96
96
  overflow: {
97
97
  xs: 'auto',
98
98
  md: 'hidden',
@@ -122,9 +122,9 @@ function CheckoutTableInner({ id, mode, onPaid, onError, onChange, extraParams,
122
122
  }}>
123
123
  {!data.livemode && <Livemode sx={{ display: 'flex', marginBottom: '8px', width: 'fit-content', ml: 0 }} />}
124
124
  <Typography
125
- color="text.primary"
126
- fontWeight={600}
127
125
  sx={{
126
+ color: 'text.primary',
127
+ fontWeight: 600,
128
128
  lineHeight: '32px',
129
129
  fontSize: '24px',
130
130
  }}>
@@ -6,8 +6,6 @@ import { fromUnitToToken } from '@ocap/util';
6
6
  import { usePaymentContext } from '../../contexts/payment';
7
7
  import { getTxLink } from '../../libs/util';
8
8
 
9
- TxGas.defaultProps = {};
10
-
11
9
  export default function TxGas(props: { details: PaymentDetails; method: TPaymentMethod }) {
12
10
  const { t } = useLocaleContext();
13
11
  const { settings } = usePaymentContext();
@@ -25,7 +23,11 @@ export default function TxGas(props: { details: PaymentDetails; method: TPayment
25
23
  }
26
24
 
27
25
  return (
28
- <Typography component="small" color="text.secondary">
26
+ <Typography
27
+ component="small"
28
+ sx={{
29
+ color: 'text.secondary',
30
+ }}>
29
31
  {t('common.none')}
30
32
  </Typography>
31
33
  );