@blocklet/payment-react 1.14.23 → 1.14.24

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.
@@ -211,7 +211,16 @@ function useDonation(settings, livemode = true, mode = "default") {
211
211
  setState
212
212
  };
213
213
  }
214
- function CheckoutDonateInner({ settings, livemode, timeout, onPaid, onError, mode, inlineOptions = {} }) {
214
+ function CheckoutDonateInner({
215
+ settings,
216
+ livemode,
217
+ timeout,
218
+ onPaid,
219
+ onError,
220
+ mode,
221
+ inlineOptions = {},
222
+ theme
223
+ }) {
215
224
  const { state, setState, donation, supporters } = useDonation(settings, livemode, mode);
216
225
  const [anchorEl, setAnchorEl] = useState(null);
217
226
  const [popoverOpen, setPopoverOpen] = useState(false);
@@ -340,15 +349,29 @@ function CheckoutDonateInner({ settings, livemode, timeout, onPaid, onError, mod
340
349
  maxWidth: "md",
341
350
  showCloseButton: true,
342
351
  disableEscapeKeyDown: true,
352
+ sx: {
353
+ ".MuiDialogContent-root": {
354
+ padding: {
355
+ xs: 0,
356
+ md: "0 16px 0"
357
+ },
358
+ borderTop: "1px solid var(--stroke-border-base, #EFF1F5)",
359
+ width: {
360
+ xs: "100%",
361
+ md: 900
362
+ }
363
+ }
364
+ },
343
365
  onClose: (e, reason) => setState({ open: reason === "backdropClick" }),
344
- children: /* @__PURE__ */ jsx(Box, { sx: { mb: 1, height: "100%" }, children: /* @__PURE__ */ jsx(
366
+ children: /* @__PURE__ */ jsx(Box, { sx: { height: "100%", width: "100%" }, children: /* @__PURE__ */ jsx(
345
367
  CheckoutForm,
346
368
  {
347
369
  id: donation.data?.id,
348
370
  onPaid: handlePaid,
349
371
  onError,
350
372
  action: settings.appearance?.button?.text,
351
- mode: "inline"
373
+ mode: "inline",
374
+ theme
352
375
  }
353
376
  ) })
354
377
  }
@@ -79,20 +79,30 @@ export default function ProductDonation({
79
79
  textAlign: "center",
80
80
  ...state.selected === amount && !state.custom ? { borderColor: "primary.main" } : {}
81
81
  },
82
- children: /* @__PURE__ */ jsx(CardActionArea, { onClick: () => handleSelect(amount), children: /* @__PURE__ */ jsxs(Stack, { direction: "row", sx: { py: 1 }, spacing: 0.5, alignItems: "flex-end", justifyContent: "center", children: [
83
- /* @__PURE__ */ jsx(
84
- Typography,
85
- {
86
- component: "strong",
87
- lineHeight: 1,
88
- variant: "h5",
89
- sx: { fontVariantNumeric: "tabular-nums", fontWeight: 400 },
90
- children: amount
91
- }
92
- ),
93
- /* @__PURE__ */ jsx(Typography, { component: "small", lineHeight: 1, fontSize: 12, children: "ABT" }),
94
- " "
95
- ] }) })
82
+ children: /* @__PURE__ */ jsx(CardActionArea, { onClick: () => handleSelect(amount), children: /* @__PURE__ */ jsxs(
83
+ Stack,
84
+ {
85
+ direction: "row",
86
+ sx: { py: 1, px: 0.5 },
87
+ spacing: 0.5,
88
+ alignItems: "flex-end",
89
+ justifyContent: "center",
90
+ children: [
91
+ /* @__PURE__ */ jsx(
92
+ Typography,
93
+ {
94
+ component: "strong",
95
+ lineHeight: 1,
96
+ variant: "h3",
97
+ sx: { fontVariantNumeric: "tabular-nums", fontWeight: 400 },
98
+ children: amount
99
+ }
100
+ ),
101
+ /* @__PURE__ */ jsx(Typography, { component: "small", lineHeight: 1, fontSize: 12, children: "ABT" }),
102
+ " "
103
+ ]
104
+ }
105
+ ) })
96
106
  },
97
107
  amount
98
108
  )) }),
@@ -251,7 +251,7 @@ export default function PaymentSummary({
251
251
  ),
252
252
  !settings.livemode && /* @__PURE__ */ jsx(Livemode, {})
253
253
  ] }),
254
- isMobile ? /* @__PURE__ */ jsxs(Fragment, { children: [
254
+ isMobile && !donationSettings ? /* @__PURE__ */ jsxs(Fragment, { children: [
255
255
  /* @__PURE__ */ jsxs(
256
256
  Stack,
257
257
  {
@@ -293,7 +293,8 @@ function CheckoutDonateInner({
293
293
  onPaid,
294
294
  onError,
295
295
  mode,
296
- inlineOptions = {}
296
+ inlineOptions = {},
297
+ theme
297
298
  }) {
298
299
  const {
299
300
  state,
@@ -446,20 +447,34 @@ function CheckoutDonateInner({
446
447
  maxWidth: "md",
447
448
  showCloseButton: true,
448
449
  disableEscapeKeyDown: true,
450
+ sx: {
451
+ ".MuiDialogContent-root": {
452
+ padding: {
453
+ xs: 0,
454
+ md: "0 16px 0"
455
+ },
456
+ borderTop: "1px solid var(--stroke-border-base, #EFF1F5)",
457
+ width: {
458
+ xs: "100%",
459
+ md: 900
460
+ }
461
+ }
462
+ },
449
463
  onClose: (e, reason) => setState({
450
464
  open: reason === "backdropClick"
451
465
  }),
452
466
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
453
467
  sx: {
454
- mb: 1,
455
- height: "100%"
468
+ height: "100%",
469
+ width: "100%"
456
470
  },
457
471
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_form.default, {
458
472
  id: donation.data?.id,
459
473
  onPaid: handlePaid,
460
474
  onError,
461
475
  action: settings.appearance?.button?.text,
462
- mode: "inline"
476
+ mode: "inline",
477
+ theme
463
478
  })
464
479
  })
465
480
  })]
@@ -151,7 +151,8 @@ function ProductDonation({
151
151
  children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
152
152
  direction: "row",
153
153
  sx: {
154
- py: 1
154
+ py: 1,
155
+ px: 0.5
155
156
  },
156
157
  spacing: 0.5,
157
158
  alignItems: "flex-end",
@@ -159,7 +160,7 @@ function ProductDonation({
159
160
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Typography, {
160
161
  component: "strong",
161
162
  lineHeight: 1,
162
- variant: "h5",
163
+ variant: "h3",
163
164
  sx: {
164
165
  fontVariantNumeric: "tabular-nums",
165
166
  fontWeight: 400
@@ -289,7 +289,7 @@ function PaymentSummary({
289
289
  },
290
290
  children: action || t("payment.checkout.orderSummary")
291
291
  }), !settings.livemode && /* @__PURE__ */(0, _jsxRuntime.jsx)(_livemode.default, {})]
292
- }), isMobile ? /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
292
+ }), isMobile && !donationSettings ? /* @__PURE__ */(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
293
293
  children: [/* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
294
294
  justifyContent: "space-between",
295
295
  flexDirection: "row",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/payment-react",
3
- "version": "1.14.23",
3
+ "version": "1.14.24",
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.23",
96
+ "@blocklet/payment-types": "1.14.24",
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": "868311b6e37e21e5755e7a78daf335f3057dd1c8"
126
+ "gitHead": "34ddc3ea5d4e166304a4966a926bfc35796193b1"
127
127
  }
@@ -301,7 +301,16 @@ function useDonation(settings: DonationSettings, livemode: boolean = true, mode
301
301
  };
302
302
  }
303
303
 
304
- function CheckoutDonateInner({ settings, livemode, timeout, onPaid, onError, mode, inlineOptions = {} }: DonateProps) {
304
+ function CheckoutDonateInner({
305
+ settings,
306
+ livemode,
307
+ timeout,
308
+ onPaid,
309
+ onError,
310
+ mode,
311
+ inlineOptions = {},
312
+ theme,
313
+ }: DonateProps) {
305
314
  // eslint-disable-line
306
315
  const { state, setState, donation, supporters } = useDonation(settings, livemode, mode);
307
316
 
@@ -442,14 +451,28 @@ function CheckoutDonateInner({ settings, livemode, timeout, onPaid, onError, mod
442
451
  maxWidth="md"
443
452
  showCloseButton
444
453
  disableEscapeKeyDown
454
+ sx={{
455
+ '.MuiDialogContent-root': {
456
+ padding: {
457
+ xs: 0,
458
+ md: '0 16px 0',
459
+ },
460
+ borderTop: '1px solid var(--stroke-border-base, #EFF1F5)',
461
+ width: {
462
+ xs: '100%',
463
+ md: 900,
464
+ },
465
+ },
466
+ }}
445
467
  onClose={(e: any, reason: string) => setState({ open: reason === 'backdropClick' })}>
446
- <Box sx={{ mb: 1, height: '100%' }}>
468
+ <Box sx={{ height: '100%', width: '100%' }}>
447
469
  <CheckoutForm
448
470
  id={donation.data?.id}
449
471
  onPaid={handlePaid}
450
472
  onError={onError}
451
473
  action={settings.appearance?.button?.text}
452
474
  mode="inline"
475
+ theme={theme}
453
476
  />
454
477
  </Box>
455
478
  </Dialog>
@@ -99,11 +99,16 @@ export default function ProductDonation({
99
99
  ...(state.selected === amount && !state.custom ? { borderColor: 'primary.main' } : {}),
100
100
  }}>
101
101
  <CardActionArea onClick={() => handleSelect(amount)}>
102
- <Stack direction="row" sx={{ py: 1 }} spacing={0.5} alignItems="flex-end" justifyContent="center">
102
+ <Stack
103
+ direction="row"
104
+ sx={{ py: 1, px: 0.5 }}
105
+ spacing={0.5}
106
+ alignItems="flex-end"
107
+ justifyContent="center">
103
108
  <Typography
104
109
  component="strong"
105
110
  lineHeight={1}
106
- variant="h5"
111
+ variant="h3"
107
112
  sx={{ fontVariantNumeric: 'tabular-nums', fontWeight: 400 }}>
108
113
  {amount}
109
114
  </Typography>
@@ -303,7 +303,7 @@ export default function PaymentSummary({
303
303
  </Typography>
304
304
  {!settings.livemode && <Livemode />}
305
305
  </Box>
306
- {isMobile ? (
306
+ {isMobile && !donationSettings ? (
307
307
  <>
308
308
  <Stack
309
309
  justifyContent="space-between"