@blocklet/payment-react 1.18.56 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) 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 +28 -7
  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/input.d.ts +11 -20
  15. package/es/components/input.js +46 -43
  16. package/es/components/lazy-loader.js +1 -2
  17. package/es/components/link.d.ts +2 -9
  18. package/es/components/link.js +9 -6
  19. package/es/components/livemode.d.ts +2 -8
  20. package/es/components/livemode.js +1 -5
  21. package/es/components/loading-button.d.ts +6 -1
  22. package/es/components/loading-button.js +56 -66
  23. package/es/components/over-due-invoice-payment.d.ts +0 -18
  24. package/es/components/over-due-invoice-payment.js +138 -95
  25. package/es/components/payment-beneficiaries.d.ts +2 -7
  26. package/es/components/payment-beneficiaries.js +86 -40
  27. package/es/components/pricing-item.d.ts +0 -5
  28. package/es/components/pricing-item.js +1 -4
  29. package/es/components/pricing-table.d.ts +2 -10
  30. package/es/components/pricing-table.js +8 -7
  31. package/es/components/resume-subscription.d.ts +0 -10
  32. package/es/components/resume-subscription.js +42 -21
  33. package/es/components/truncated-text.d.ts +2 -9
  34. package/es/components/truncated-text.js +0 -5
  35. package/es/contexts/donate.d.ts +0 -7
  36. package/es/contexts/donate.js +10 -8
  37. package/es/contexts/payment.d.ts +1 -4
  38. package/es/contexts/payment.js +7 -2
  39. package/es/history/invoice/list.d.ts +2 -18
  40. package/es/history/invoice/list.js +151 -73
  41. package/es/history/payment/list.js +115 -38
  42. package/es/hooks/keyboard.d.ts +1 -1
  43. package/es/hooks/keyboard.js +2 -4
  44. package/es/libs/cached-request.js +2 -4
  45. package/es/libs/phone-validator.js +1 -2
  46. package/es/libs/util.js +2 -4
  47. package/es/libs/validator.js +2 -4
  48. package/es/payment/amount.d.ts +2 -7
  49. package/es/payment/amount.js +1 -5
  50. package/es/payment/donation-form.d.ts +2 -10
  51. package/es/payment/donation-form.js +196 -160
  52. package/es/payment/error.d.ts +2 -8
  53. package/es/payment/error.js +40 -20
  54. package/es/payment/footer.d.ts +2 -3
  55. package/es/payment/footer.js +19 -6
  56. package/es/payment/form/addon.js +14 -4
  57. package/es/payment/form/address.d.ts +2 -9
  58. package/es/payment/form/address.js +3 -6
  59. package/es/payment/form/currency.js +45 -25
  60. package/es/payment/form/index.d.ts +2 -8
  61. package/es/payment/form/index.js +107 -65
  62. package/es/payment/form/phone.js +2 -4
  63. package/es/payment/form/stripe/form.d.ts +2 -8
  64. package/es/payment/form/stripe/form.js +1 -3
  65. package/es/payment/header.js +38 -16
  66. package/es/payment/index.d.ts +2 -9
  67. package/es/payment/index.js +5 -14
  68. package/es/payment/product-card.d.ts +2 -11
  69. package/es/payment/product-card.js +84 -50
  70. package/es/payment/product-donation.js +175 -114
  71. package/es/payment/product-item.d.ts +2 -9
  72. package/es/payment/product-item.js +185 -142
  73. package/es/payment/product-skeleton.js +2 -2
  74. package/es/payment/skeleton/donation.js +27 -7
  75. package/es/payment/skeleton/overview.js +22 -2
  76. package/es/payment/skeleton/payment.js +33 -5
  77. package/es/payment/success.d.ts +2 -9
  78. package/es/payment/success.js +41 -14
  79. package/es/payment/summary.d.ts +2 -17
  80. package/es/payment/summary.js +184 -111
  81. package/es/theme/index.d.ts +0 -5
  82. package/es/theme/index.js +2 -5
  83. package/es/theme/typography.d.ts +2 -2
  84. package/lib/checkout/donate.d.ts +1 -15
  85. package/lib/checkout/donate.js +75 -54
  86. package/lib/checkout/form.d.ts +1 -15
  87. package/lib/checkout/form.js +7 -15
  88. package/lib/checkout/table.js +4 -4
  89. package/lib/components/blockchain/gas.d.ts +1 -5
  90. package/lib/components/blockchain/gas.js +3 -2
  91. package/lib/components/blockchain/tx.d.ts +1 -8
  92. package/lib/components/blockchain/tx.js +11 -7
  93. package/lib/components/confirm.d.ts +1 -10
  94. package/lib/components/confirm.js +5 -11
  95. package/lib/components/country-select.d.ts +3 -2
  96. package/lib/components/country-select.js +23 -22
  97. package/lib/components/input.d.ts +11 -20
  98. package/lib/components/input.js +20 -23
  99. package/lib/components/lazy-loader.js +1 -1
  100. package/lib/components/link.d.ts +2 -9
  101. package/lib/components/link.js +3 -8
  102. package/lib/components/livemode.d.ts +2 -8
  103. package/lib/components/livemode.js +3 -7
  104. package/lib/components/loading-button.d.ts +6 -1
  105. package/lib/components/loading-button.js +9 -17
  106. package/lib/components/over-due-invoice-payment.d.ts +0 -18
  107. package/lib/components/over-due-invoice-payment.js +31 -33
  108. package/lib/components/payment-beneficiaries.d.ts +2 -7
  109. package/lib/components/payment-beneficiaries.js +12 -11
  110. package/lib/components/pricing-item.d.ts +0 -5
  111. package/lib/components/pricing-item.js +2 -5
  112. package/lib/components/pricing-table.d.ts +2 -10
  113. package/lib/components/pricing-table.js +5 -11
  114. package/lib/components/resume-subscription.d.ts +0 -10
  115. package/lib/components/resume-subscription.js +16 -16
  116. package/lib/components/table.js +1 -1
  117. package/lib/components/truncated-text.d.ts +2 -9
  118. package/lib/components/truncated-text.js +1 -6
  119. package/lib/contexts/donate.d.ts +0 -7
  120. package/lib/contexts/donate.js +4 -7
  121. package/lib/contexts/payment.d.ts +1 -4
  122. package/lib/contexts/payment.js +4 -7
  123. package/lib/history/invoice/list.d.ts +2 -18
  124. package/lib/history/invoice/list.js +49 -37
  125. package/lib/history/payment/list.js +30 -16
  126. package/lib/hooks/keyboard.d.ts +1 -1
  127. package/lib/hooks/mobile.js +1 -1
  128. package/lib/hooks/subscription.js +1 -1
  129. package/lib/index.js +2 -2
  130. package/lib/libs/api.js +1 -1
  131. package/lib/libs/dayjs.js +1 -1
  132. package/lib/libs/phone-validator.js +0 -2
  133. package/lib/libs/theme.js +1 -1
  134. package/lib/libs/util.js +1 -1
  135. package/lib/libs/validator.js +1 -1
  136. package/lib/locales/en.js +1 -1
  137. package/lib/locales/index.js +1 -1
  138. package/lib/locales/zh.js +1 -1
  139. package/lib/payment/amount.d.ts +2 -7
  140. package/lib/payment/amount.js +2 -6
  141. package/lib/payment/donation-form.d.ts +2 -10
  142. package/lib/payment/donation-form.js +33 -38
  143. package/lib/payment/error.d.ts +2 -8
  144. package/lib/payment/error.js +11 -13
  145. package/lib/payment/footer.d.ts +2 -3
  146. package/lib/payment/footer.js +5 -5
  147. package/lib/payment/form/addon.js +5 -3
  148. package/lib/payment/form/address.d.ts +2 -9
  149. package/lib/payment/form/address.js +5 -8
  150. package/lib/payment/form/currency.js +3 -3
  151. package/lib/payment/form/index.d.ts +2 -8
  152. package/lib/payment/form/index.js +19 -15
  153. package/lib/payment/form/phone.js +1 -1
  154. package/lib/payment/form/stripe/form.d.ts +2 -8
  155. package/lib/payment/form/stripe/form.js +3 -6
  156. package/lib/payment/header.js +8 -4
  157. package/lib/payment/index.d.ts +2 -9
  158. package/lib/payment/index.js +7 -16
  159. package/lib/payment/product-card.d.ts +2 -11
  160. package/lib/payment/product-card.js +13 -20
  161. package/lib/payment/product-donation.js +71 -66
  162. package/lib/payment/product-item.d.ts +2 -9
  163. package/lib/payment/product-item.js +24 -25
  164. package/lib/payment/product-skeleton.js +2 -2
  165. package/lib/payment/skeleton/donation.js +8 -4
  166. package/lib/payment/skeleton/overview.js +6 -2
  167. package/lib/payment/skeleton/payment.js +9 -3
  168. package/lib/payment/success.d.ts +2 -9
  169. package/lib/payment/success.js +12 -15
  170. package/lib/payment/summary.d.ts +2 -17
  171. package/lib/payment/summary.js +44 -45
  172. package/lib/theme/index.d.ts +0 -5
  173. package/lib/theme/index.js +2 -5
  174. package/lib/theme/typography.d.ts +2 -2
  175. package/package.json +40 -40
  176. package/src/checkout/donate.tsx +103 -35
  177. package/src/checkout/form.tsx +5 -14
  178. package/src/checkout/table.tsx +3 -3
  179. package/src/components/blockchain/gas.tsx +5 -3
  180. package/src/components/blockchain/tx.tsx +22 -8
  181. package/src/components/confirm.tsx +4 -11
  182. package/src/components/country-select.tsx +391 -378
  183. package/src/components/input.tsx +49 -45
  184. package/src/components/link.tsx +9 -7
  185. package/src/components/livemode.tsx +2 -6
  186. package/src/components/loading-button.tsx +63 -76
  187. package/src/components/over-due-invoice-payment.tsx +43 -28
  188. package/src/components/payment-beneficiaries.tsx +33 -14
  189. package/src/components/pricing-item.tsx +1 -4
  190. package/src/components/pricing-table.tsx +8 -8
  191. package/src/components/resume-subscription.tsx +20 -14
  192. package/src/components/table.tsx +2 -2
  193. package/src/components/truncated-text.tsx +0 -6
  194. package/src/contexts/donate.tsx +6 -7
  195. package/src/contexts/payment.tsx +7 -3
  196. package/src/history/invoice/list.tsx +74 -35
  197. package/src/history/payment/list.tsx +53 -16
  198. package/src/hooks/keyboard.ts +1 -1
  199. package/src/payment/amount.tsx +1 -6
  200. package/src/payment/donation-form.tsx +47 -29
  201. package/src/payment/error.tsx +16 -8
  202. package/src/payment/footer.tsx +11 -3
  203. package/src/payment/form/addon.tsx +6 -1
  204. package/src/payment/form/address.tsx +3 -7
  205. package/src/payment/form/currency.tsx +12 -2
  206. package/src/payment/form/index.tsx +30 -12
  207. package/src/payment/form/stripe/form.tsx +1 -5
  208. package/src/payment/header.tsx +14 -2
  209. package/src/payment/index.tsx +10 -21
  210. package/src/payment/product-card.tsx +41 -18
  211. package/src/payment/product-donation.tsx +85 -47
  212. package/src/payment/product-item.tsx +46 -24
  213. package/src/payment/product-skeleton.tsx +3 -2
  214. package/src/payment/skeleton/donation.tsx +12 -2
  215. package/src/payment/skeleton/overview.tsx +12 -2
  216. package/src/payment/skeleton/payment.tsx +16 -3
  217. package/src/payment/success.tsx +26 -15
  218. package/src/payment/summary.tsx +74 -42
  219. package/src/theme/index.tsx +5 -8
  220. package/src/theme/typography.ts +2 -2
@@ -66,34 +66,21 @@ function getStakingSetup(items, currency, billingThreshold = 0) {
66
66
  }
67
67
  return "0";
68
68
  }
69
- PaymentSummary.defaultProps = {
70
- onUpsell: noop,
71
- onDownsell: noop,
72
- onApplyCrossSell: noop,
73
- onCancelCrossSell: noop,
74
- onChangeAmount: noop,
75
- checkoutSessionId: "",
76
- crossSellBehavior: "",
77
- showStaking: false,
78
- donationSettings: null,
79
- action: "",
80
- trialEnd: 0
81
- };
82
69
  export default function PaymentSummary({
83
70
  items,
84
71
  currency,
85
72
  trialInDays,
86
73
  billingThreshold,
87
- onUpsell,
88
- onDownsell,
89
- onApplyCrossSell,
90
- onCancelCrossSell,
91
- onChangeAmount,
92
- checkoutSessionId,
93
- crossSellBehavior,
94
- showStaking,
95
- donationSettings,
96
- action,
74
+ onUpsell = noop,
75
+ onDownsell = noop,
76
+ onApplyCrossSell = noop,
77
+ onCancelCrossSell = noop,
78
+ onChangeAmount = noop,
79
+ checkoutSessionId = "",
80
+ crossSellBehavior = "",
81
+ showStaking = false,
82
+ donationSettings = void 0,
83
+ action = "",
97
84
  trialEnd = 0,
98
85
  ...rest
99
86
  }) {
@@ -179,86 +166,128 @@ export default function PaymentSummary({
179
166
  currency,
180
167
  onUpsell: handleUpsell,
181
168
  onDownsell: handleDownsell,
182
- children: x.cross_sell && /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", sx: { width: 1 }, children: [
183
- /* @__PURE__ */ jsx(Typography, {}),
184
- /* @__PURE__ */ jsx(
185
- LoadingButton,
186
- {
187
- size: "small",
188
- loadingPosition: "end",
189
- endIcon: null,
190
- color: "error",
191
- variant: "text",
192
- loading: state.loading,
193
- onClick: handleCancelCrossSell,
194
- children: t("payment.checkout.cross_sell.remove")
195
- }
196
- )
197
- ] })
169
+ children: x.cross_sell && /* @__PURE__ */ jsxs(
170
+ Stack,
171
+ {
172
+ direction: "row",
173
+ sx: {
174
+ alignItems: "center",
175
+ justifyContent: "space-between",
176
+ width: 1
177
+ },
178
+ children: [
179
+ /* @__PURE__ */ jsx(Typography, {}),
180
+ /* @__PURE__ */ jsx(
181
+ LoadingButton,
182
+ {
183
+ size: "small",
184
+ loadingPosition: "end",
185
+ endIcon: null,
186
+ color: "error",
187
+ variant: "text",
188
+ loading: state.loading,
189
+ onClick: handleCancelCrossSell,
190
+ children: t("payment.checkout.cross_sell.remove")
191
+ }
192
+ )
193
+ ]
194
+ }
195
+ )
198
196
  },
199
197
  `${x.price_id}-${currency.id}`
200
198
  )
201
199
  ) }),
202
- data && items.some((x) => x.price_id === data.id) === false && /* @__PURE__ */ jsx(Grow, { in: true, children: /* @__PURE__ */ jsx(Stack, { mt: 1, children: /* @__PURE__ */ jsx(
203
- ProductItem,
200
+ data && items.some((x) => x.price_id === data.id) === false && /* @__PURE__ */ jsx(Grow, { in: true, children: /* @__PURE__ */ jsx(
201
+ Stack,
204
202
  {
205
- item: { quantity: 1, price: data, price_id: data.id, cross_sell: true },
206
- items,
207
- trialInDays,
208
- currency,
209
- trialEnd,
210
- onUpsell: noop,
211
- onDownsell: noop,
212
- children: /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", justifyContent: "space-between", sx: { width: 1 }, children: [
213
- /* @__PURE__ */ jsx(Typography, { children: crossSellBehavior === "required" && /* @__PURE__ */ jsx(Status, { label: t("payment.checkout.required"), color: "info", variant: "outlined", sx: { mr: 1 } }) }),
214
- /* @__PURE__ */ jsx(
215
- LoadingButton,
216
- {
217
- size: "small",
218
- loadingPosition: "end",
219
- endIcon: null,
220
- color: crossSellBehavior === "required" ? "info" : "info",
221
- variant: crossSellBehavior === "required" ? "text" : "text",
222
- loading: state.loading,
223
- onClick: handleApplyCrossSell,
224
- children: t("payment.checkout.cross_sell.add")
225
- }
226
- )
227
- ] })
203
+ sx: {
204
+ mt: 1
205
+ },
206
+ children: /* @__PURE__ */ jsx(
207
+ ProductItem,
208
+ {
209
+ item: { quantity: 1, price: data, price_id: data.id, cross_sell: true },
210
+ items,
211
+ trialInDays,
212
+ currency,
213
+ trialEnd,
214
+ onUpsell: noop,
215
+ onDownsell: noop,
216
+ children: /* @__PURE__ */ jsxs(
217
+ Stack,
218
+ {
219
+ direction: "row",
220
+ sx: {
221
+ alignItems: "center",
222
+ justifyContent: "space-between",
223
+ width: 1
224
+ },
225
+ children: [
226
+ /* @__PURE__ */ jsx(Typography, { children: crossSellBehavior === "required" && /* @__PURE__ */ jsx(Status, { label: t("payment.checkout.required"), color: "info", variant: "outlined", sx: { mr: 1 } }) }),
227
+ /* @__PURE__ */ jsx(
228
+ LoadingButton,
229
+ {
230
+ size: "small",
231
+ loadingPosition: "end",
232
+ endIcon: null,
233
+ color: crossSellBehavior === "required" ? "info" : "info",
234
+ variant: crossSellBehavior === "required" ? "text" : "text",
235
+ loading: state.loading,
236
+ onClick: handleApplyCrossSell,
237
+ children: t("payment.checkout.cross_sell.add")
238
+ }
239
+ )
240
+ ]
241
+ }
242
+ )
243
+ }
244
+ )
228
245
  }
229
- ) }) })
246
+ ) })
230
247
  ]
231
248
  }
232
249
  );
233
250
  return /* @__PURE__ */ jsx(Fade, { in: true, children: /* @__PURE__ */ jsxs(Stack, { className: "cko-product", direction: "column", ...rest, children: [
234
- /* @__PURE__ */ jsxs(Box, { display: "flex", alignItems: "center", sx: { mb: 2.5 }, children: [
235
- /* @__PURE__ */ jsx(
236
- Typography,
237
- {
238
- title: t("payment.checkout.orderSummary"),
239
- sx: {
240
- color: "text.primary",
241
- fontSize: {
242
- xs: "18px",
243
- md: "24px"
244
- },
245
- fontWeight: "700",
246
- lineHeight: "32px"
247
- },
248
- children: action || t("payment.checkout.orderSummary")
249
- }
250
- ),
251
- !settings.livemode && /* @__PURE__ */ jsx(Livemode, {})
252
- ] }),
251
+ /* @__PURE__ */ jsxs(
252
+ Box,
253
+ {
254
+ sx: {
255
+ display: "flex",
256
+ alignItems: "center",
257
+ mb: 2.5
258
+ },
259
+ children: [
260
+ /* @__PURE__ */ jsx(
261
+ Typography,
262
+ {
263
+ title: t("payment.checkout.orderSummary"),
264
+ sx: {
265
+ color: "text.primary",
266
+ fontSize: {
267
+ xs: "18px",
268
+ md: "24px"
269
+ },
270
+ fontWeight: "700",
271
+ lineHeight: "32px"
272
+ },
273
+ children: action || t("payment.checkout.orderSummary")
274
+ }
275
+ ),
276
+ !settings.livemode && /* @__PURE__ */ jsx(Livemode, {})
277
+ ]
278
+ }
279
+ ),
253
280
  isMobile && !donationSettings ? /* @__PURE__ */ jsxs(Fragment, { children: [
254
281
  /* @__PURE__ */ jsxs(
255
282
  Stack,
256
283
  {
257
- justifyContent: "space-between",
258
- flexDirection: "row",
259
- alignItems: "center",
260
- mb: 1.5,
261
284
  onClick: () => setState({ expanded: !state.expanded }),
285
+ sx: {
286
+ justifyContent: "space-between",
287
+ flexDirection: "row",
288
+ alignItems: "center",
289
+ mb: 1.5
290
+ },
262
291
  children: [
263
292
  /* @__PURE__ */ jsx(Typography, { children: t("payment.checkout.productListTotal", { total: items.length }) }),
264
293
  /* @__PURE__ */ jsx(ExpandMore, { expand: state.expanded, "aria-expanded": state.expanded, "aria-label": "show more", children: /* @__PURE__ */ jsx(ExpandMoreIcon, {}) })
@@ -269,33 +298,77 @@ export default function PaymentSummary({
269
298
  ] }) : ProductCardList,
270
299
  /* @__PURE__ */ jsx(Divider, { sx: { mt: 2.5, mb: 2.5 } }),
271
300
  staking > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
272
- /* @__PURE__ */ jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 1, children: [
273
- /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", spacing: 0.5, children: [
274
- /* @__PURE__ */ jsx(Typography, { sx: { color: "text.secondary" }, children: t("payment.checkout.paymentRequired") }),
275
- /* @__PURE__ */ jsx(Tooltip, { title: t("payment.checkout.stakingConfirm"), placement: "top", sx: { maxWidth: "150px" }, children: /* @__PURE__ */ jsx(HelpOutline, { fontSize: "small", sx: { color: "text.lighter" } }) })
276
- ] }),
277
- /* @__PURE__ */ jsx(Typography, { children: headlines.amount })
278
- ] }),
279
- /* @__PURE__ */ jsxs(Stack, { direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 1, children: [
280
- /* @__PURE__ */ jsxs(Stack, { direction: "row", alignItems: "center", spacing: 0.5, children: [
281
- /* @__PURE__ */ jsx(Typography, { sx: { color: "text.secondary" }, children: t("payment.checkout.staking.title") }),
282
- /* @__PURE__ */ jsx(Tooltip, { title: t("payment.checkout.staking.tooltip"), placement: "top", sx: { maxWidth: "150px" }, children: /* @__PURE__ */ jsx(HelpOutline, { fontSize: "small", sx: { color: "text.lighter" } }) })
283
- ] }),
284
- /* @__PURE__ */ jsxs(Typography, { children: [
285
- formatAmount(staking, currency.decimal),
286
- " ",
287
- currency.symbol
288
- ] })
289
- ] })
301
+ /* @__PURE__ */ jsxs(
302
+ Stack,
303
+ {
304
+ direction: "row",
305
+ spacing: 1,
306
+ sx: {
307
+ justifyContent: "space-between",
308
+ alignItems: "center"
309
+ },
310
+ children: [
311
+ /* @__PURE__ */ jsxs(
312
+ Stack,
313
+ {
314
+ direction: "row",
315
+ spacing: 0.5,
316
+ sx: {
317
+ alignItems: "center"
318
+ },
319
+ children: [
320
+ /* @__PURE__ */ jsx(Typography, { sx: { color: "text.secondary" }, children: t("payment.checkout.paymentRequired") }),
321
+ /* @__PURE__ */ jsx(Tooltip, { title: t("payment.checkout.stakingConfirm"), placement: "top", sx: { maxWidth: "150px" }, children: /* @__PURE__ */ jsx(HelpOutline, { fontSize: "small", sx: { color: "text.lighter" } }) })
322
+ ]
323
+ }
324
+ ),
325
+ /* @__PURE__ */ jsx(Typography, { children: headlines.amount })
326
+ ]
327
+ }
328
+ ),
329
+ /* @__PURE__ */ jsxs(
330
+ Stack,
331
+ {
332
+ direction: "row",
333
+ spacing: 1,
334
+ sx: {
335
+ justifyContent: "space-between",
336
+ alignItems: "center"
337
+ },
338
+ children: [
339
+ /* @__PURE__ */ jsxs(
340
+ Stack,
341
+ {
342
+ direction: "row",
343
+ spacing: 0.5,
344
+ sx: {
345
+ alignItems: "center"
346
+ },
347
+ children: [
348
+ /* @__PURE__ */ jsx(Typography, { sx: { color: "text.secondary" }, children: t("payment.checkout.staking.title") }),
349
+ /* @__PURE__ */ jsx(Tooltip, { title: t("payment.checkout.staking.tooltip"), placement: "top", sx: { maxWidth: "150px" }, children: /* @__PURE__ */ jsx(HelpOutline, { fontSize: "small", sx: { color: "text.lighter" } }) })
350
+ ]
351
+ }
352
+ ),
353
+ /* @__PURE__ */ jsxs(Typography, { children: [
354
+ formatAmount(staking, currency.decimal),
355
+ " ",
356
+ currency.symbol
357
+ ] })
358
+ ]
359
+ }
360
+ )
290
361
  ] }),
291
362
  /* @__PURE__ */ jsxs(
292
363
  Stack,
293
364
  {
294
- display: "flex",
295
- justifyContent: "space-between",
296
- flexDirection: "row",
297
- alignItems: "center",
298
- sx: { width: "100%" },
365
+ sx: {
366
+ display: "flex",
367
+ justifyContent: "space-between",
368
+ flexDirection: "row",
369
+ alignItems: "center",
370
+ width: "100%"
371
+ },
299
372
  children: [
300
373
  /* @__PURE__ */ jsxs(Box, { className: "base-label", children: [
301
374
  t("common.total"),
@@ -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 };
package/es/theme/index.js CHANGED
@@ -7,9 +7,6 @@ import { useMemo } from "react";
7
7
  import "./index.css";
8
8
  import "./types";
9
9
  import { typography } from "./typography.js";
10
- PaymentThemeProvider.defaultProps = {
11
- theme: {}
12
- };
13
10
  export function PaymentThemeProvider({
14
11
  children,
15
12
  theme: customTheme = {}
@@ -261,7 +258,7 @@ export function PaymentThemeProvider({
261
258
  backgroundColor: palette.chip.default.background,
262
259
  borderColor: palette.chip.default.border
263
260
  },
264
- "&.MuiChip-filledSecondary": {
261
+ "&.MuiChip-filled.MuiChip-colorSecondary": {
265
262
  color: palette.chip.secondary.text,
266
263
  backgroundColor: palette.chip.secondary.background,
267
264
  borderColor: palette.chip.secondary.border
@@ -276,7 +273,7 @@ export function PaymentThemeProvider({
276
273
  backgroundColor: palette.chip.warning.background,
277
274
  borderColor: palette.chip.warning.border
278
275
  },
279
- "&.MuiChip-filledPrimary,&.MuiChip-filledInfo": {
276
+ "&.MuiChip-filled.MuiChip-colorPrimary,&.MuiChip-filledInfo": {
280
277
  color: palette.chip.info.text,
281
278
  backgroundColor: palette.chip.info.background,
282
279
  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;
@@ -50,18 +50,4 @@ export type DonateProps = Pick<CheckoutProps, 'onPaid' | 'onError'> & {
50
50
  children?: (openDialog: () => void, donateTotalAmount: string, supporters: DonateHistory, loading?: boolean, donateSettings?: DonationSettings) => React.ReactNode;
51
51
  };
52
52
  export declare function DonateDetails({ supporters, currency, method }: DonateHistory): import("react").JSX.Element;
53
- declare function CheckoutDonate(props: DonateProps): import("react").JSX.Element;
54
- declare namespace CheckoutDonate {
55
- var defaultProps: {
56
- theme: string;
57
- livemode: undefined;
58
- timeout: number;
59
- mode: string;
60
- inlineOptions: {
61
- button: {
62
- text: string;
63
- };
64
- };
65
- };
66
- }
67
- export default CheckoutDonate;
53
+ export default function CheckoutDonate(rawProps: DonateProps): import("react").JSX.Element;
@@ -22,7 +22,7 @@ var _payment = require("../contexts/payment");
22
22
  var _livemode = _interopRequireDefault(require("../components/livemode"));
23
23
  var _mobile = require("../hooks/mobile");
24
24
  var _donate = require("../contexts/donate");
25
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
25
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
26
26
  const donationCache = {};
27
27
  const createOrUpdateDonation = (settings, livemode = true) => {
28
28
  const donationKey = `${settings.target}-${livemode}`;
@@ -98,9 +98,9 @@ function DonateDetails({
98
98
  },
99
99
  children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
100
100
  direction: "row",
101
- alignItems: "center",
102
101
  spacing: 0.5,
103
102
  sx: {
103
+ alignItems: "center",
104
104
  flex: 3,
105
105
  overflow: "hidden"
106
106
  },
@@ -143,10 +143,10 @@ function DonateDetails({
143
143
  })]
144
144
  }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
145
145
  direction: "row",
146
- alignItems: "center",
147
- justifyContent: "flex-end",
148
146
  spacing: 0.5,
149
147
  sx: {
148
+ alignItems: "center",
149
+ justifyContent: "flex-end",
150
150
  flex: 1
151
151
  },
152
152
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Avatar, {
@@ -184,9 +184,11 @@ function SupporterAvatar({
184
184
  const customersNum = customers.length;
185
185
  if (customersNum === 0) return null;
186
186
  return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
187
- flexDirection: "row",
188
- justifyContent: "center",
189
- alignItems: "center",
187
+ sx: {
188
+ flexDirection: "row",
189
+ justifyContent: "center",
190
+ alignItems: "center"
191
+ },
190
192
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.AvatarGroup, {
191
193
  max: 5,
192
194
  sx: {
@@ -262,12 +264,14 @@ function SupporterTable({
262
264
  const customersNum = customers.length;
263
265
  if (customersNum === 0) return null;
264
266
  return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
265
- display: "flex",
266
- flexDirection: "column",
267
- alignItems: "center",
268
- gap: {
269
- xs: 0.5,
270
- sm: 1
267
+ sx: {
268
+ display: "flex",
269
+ flexDirection: "column",
270
+ alignItems: "center",
271
+ gap: {
272
+ xs: 0.5,
273
+ sm: 1
274
+ }
271
275
  },
272
276
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(SupporterAvatar, {
273
277
  supporters,
@@ -294,16 +298,20 @@ function SupporterSimple({
294
298
  const customers = (0, _uniqBy.default)(supporters, "customer_id");
295
299
  const customersNum = customers.length;
296
300
  return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
297
- display: "flex",
298
- flexDirection: "column",
299
- alignItems: "center",
300
- gap: {
301
- xs: 0.5,
302
- sm: 1
301
+ sx: {
302
+ display: "flex",
303
+ flexDirection: "column",
304
+ alignItems: "center",
305
+ gap: {
306
+ xs: 0.5,
307
+ sm: 1
308
+ }
303
309
  },
304
310
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
305
311
  component: "p",
306
- color: "text.secondary",
312
+ sx: {
313
+ color: "text.secondary"
314
+ },
307
315
  children: customersNum === 0 ? /* @__PURE__ */(0, _jsxRuntime.jsx)("span", {
308
316
  style: emojiFont,
309
317
  children: t("payment.checkout.donation.empty")
@@ -485,8 +493,10 @@ function CheckoutDonateInner({
485
493
  onClick: handlePopoverOpen,
486
494
  children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
487
495
  direction: "row",
488
- alignItems: "center",
489
496
  spacing: 0.5,
497
+ sx: {
498
+ alignItems: "center"
499
+ },
490
500
  children: [donateSettings.appearance.button.icon, typeof donateSettings.appearance.button.text === "string" ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
491
501
  sx: {
492
502
  whiteSpace: "nowrap"
@@ -527,17 +537,21 @@ function CheckoutDonateInner({
527
537
  },
528
538
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.CircularProgress, {})
529
539
  }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
530
- display: "flex",
531
- alignItems: "center",
532
- flexDirection: "column",
533
- gap: 2,
540
+ sx: {
541
+ display: "flex",
542
+ alignItems: "center",
543
+ flexDirection: "column",
544
+ gap: 2
545
+ },
534
546
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
535
547
  ...inlineOptions.button,
536
548
  onClick: () => startDonate(),
537
549
  children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
538
550
  direction: "row",
539
- alignItems: "center",
540
551
  spacing: 0.5,
552
+ sx: {
553
+ alignItems: "center"
554
+ },
541
555
  children: [inlineOptions?.button?.icon, typeof inlineText === "string" ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
542
556
  sx: {
543
557
  whiteSpace: "nowrap"
@@ -554,17 +568,17 @@ function CheckoutDonateInner({
554
568
  });
555
569
  const defaultRender = /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
556
570
  sx: {
571
+ display: "flex",
572
+ flexDirection: "column",
573
+ alignItems: "center",
574
+ gap: {
575
+ xs: 1,
576
+ sm: 2
577
+ },
557
578
  width: "100%",
558
579
  minWidth: 300,
559
580
  maxWidth: 720
560
581
  },
561
- display: "flex",
562
- flexDirection: "column",
563
- alignItems: "center",
564
- gap: {
565
- xs: 1,
566
- sm: 2
567
- },
568
582
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
569
583
  size: donateSettings.appearance?.button?.size || "medium",
570
584
  color: donateSettings.appearance?.button?.color || "primary",
@@ -581,8 +595,10 @@ function CheckoutDonateInner({
581
595
  onClick: () => startDonate(),
582
596
  children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
583
597
  direction: "row",
584
- alignItems: "center",
585
598
  spacing: 0.5,
599
+ sx: {
600
+ alignItems: "center"
601
+ },
586
602
  children: [donateSettings.appearance.button.icon && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
587
603
  sx: {
588
604
  mr: 0.5,
@@ -622,9 +638,11 @@ function CheckoutDonateInner({
622
638
  children: [renderInnerView(), donation.data && /* @__PURE__ */(0, _jsxRuntime.jsx)(_Dialog.default, {
623
639
  open: state.open,
624
640
  title: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
625
- display: "flex",
626
- alignItems: "center",
627
- gap: 0.5,
641
+ sx: {
642
+ display: "flex",
643
+ alignItems: "center",
644
+ gap: 0.5
645
+ },
628
646
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
629
647
  variant: "h3",
630
648
  sx: {
@@ -658,10 +676,10 @@ function CheckoutDonateInner({
658
676
  }),
659
677
  maxWidth: "md",
660
678
  toolbar: isMobile ? null : /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
661
- display: "flex",
662
- alignItems: "center",
663
- gap: 1,
664
679
  sx: {
680
+ display: "flex",
681
+ alignItems: "center",
682
+ gap: 1,
665
683
  color: "text.secondary"
666
684
  },
667
685
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.AvatarGroup, {
@@ -749,11 +767,25 @@ function CheckoutDonateInner({
749
767
  })]
750
768
  });
751
769
  }
752
- function CheckoutDonate(props) {
770
+ function CheckoutDonate(rawProps) {
771
+ const props = Object.assign({
772
+ theme: "default",
773
+ livemode: void 0,
774
+ inlineOptions: {
775
+ button: {
776
+ text: "Tip"
777
+ }
778
+ },
779
+ timeout: 5e3,
780
+ mode: "default"
781
+ }, rawProps);
753
782
  const {
754
783
  livemode
755
784
  } = (0, _payment.usePaymentContext)();
756
- const content = /* @__PURE__ */(0, _jsxRuntime.jsx)(CheckoutDonateInner, {
785
+ const content =
786
+ // eslint-disable-next-line react/prop-types
787
+ /* @__PURE__ */
788
+ (0, _jsxRuntime.jsx)(CheckoutDonateInner, {
757
789
  ...props,
758
790
  livemode: props.livemode === void 0 ? livemode : props.livemode
759
791
  });
@@ -769,15 +801,4 @@ function CheckoutDonate(props) {
769
801
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_theme.PaymentThemeProvider, {
770
802
  children: content
771
803
  });
772
- }
773
- CheckoutDonate.defaultProps = {
774
- theme: "default",
775
- livemode: void 0,
776
- timeout: 5e3,
777
- mode: "default",
778
- inlineOptions: {
779
- button: {
780
- text: "Tip"
781
- }
782
- }
783
- };
804
+ }
@@ -1,16 +1,2 @@
1
1
  import type { CheckoutProps } from '../types';
2
- declare function CheckoutForm({ id, mode, onPaid, onError, onChange, goBack, extraParams, action, theme, formType, ...restProps }: CheckoutProps): import("react").JSX.Element;
3
- declare namespace CheckoutForm {
4
- var defaultProps: {
5
- onPaid: any;
6
- onError: {
7
- (...data: any[]): void;
8
- (message?: any, ...optionalParams: any[]): void;
9
- };
10
- mode: string;
11
- action: string;
12
- extraParams: {};
13
- formType: string;
14
- };
15
- }
16
- export default CheckoutForm;
2
+ export default function CheckoutForm({ id, mode, onPaid, onError, onChange, goBack, extraParams, action, theme, formType, ...restProps }: CheckoutProps): import("react").JSX.Element;