@blocklet/payment-react 1.13.277 → 1.13.281

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.
@@ -186,7 +186,7 @@ export default function CheckoutDonate({ settings, livemode, timeout, onPaid, on
186
186
  showCloseButton: true,
187
187
  disableEscapeKeyDown: true,
188
188
  onClose: (e, reason) => setState({ open: reason === "backdropClick" }),
189
- children: /* @__PURE__ */ jsx(Box, { sx: { mb: 1, mt: -2 }, children: /* @__PURE__ */ jsx(
189
+ children: /* @__PURE__ */ jsx(Box, { sx: { mb: 1, mt: -2, height: "100%" }, children: /* @__PURE__ */ jsx(
190
190
  CheckoutForm,
191
191
  {
192
192
  id: donation.data.id,
@@ -89,7 +89,7 @@ export default function CheckoutTable({ id, mode, onPaid, onError, onChange, ext
89
89
  }
90
90
  return /* @__PURE__ */ jsx(PricingTable, { mode: "select", table: data, onSelect: handleSelect });
91
91
  }
92
- return /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
92
+ return /* @__PURE__ */ jsx(Box, { sx: { height: "100%" }, children: /* @__PURE__ */ jsx(
93
93
  CheckoutForm,
94
94
  {
95
95
  id: hashSessionId || sessionId,
@@ -1,9 +1,11 @@
1
1
  /// <reference types="react" />
2
+ import type { LiteralUnion } from 'type-fest';
3
+ type ModeType = LiteralUnion<'standalone' | 'inline' | 'popup' | 'inline-minimal' | 'popup-minimal', string>;
2
4
  type Props = {
3
5
  title: string;
4
6
  description: string;
5
7
  button?: string;
6
- mode?: string;
8
+ mode?: ModeType;
7
9
  };
8
10
  declare function PaymentError({ title, description, button, mode }: Props): import("react").JSX.Element;
9
11
  declare namespace PaymentError {
@@ -1,7 +1,16 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Button, Link, Stack, Typography } from "@mui/material";
3
+ function getHeightStyle(mode) {
4
+ switch (mode) {
5
+ case "standalone":
6
+ return { height: "100%" };
7
+ default:
8
+ return { height: "auto", minHeight: 200 };
9
+ }
10
+ }
3
11
  export default function PaymentError({ title, description, button, mode }) {
4
- return /* @__PURE__ */ jsx(Stack, { sx: { height: mode === "inline" ? "auto" : "100vh" }, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs(Stack, { sx: { width: "280px" }, direction: "column", alignItems: "center", justifyContent: "center", children: [
12
+ const heightStyle = getHeightStyle(mode);
13
+ return /* @__PURE__ */ jsx(Stack, { sx: heightStyle, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsxs(Stack, { sx: { width: "280px" }, direction: "column", alignItems: "center", justifyContent: "center", children: [
5
14
  /* @__PURE__ */ jsx(Typography, { variant: "h5", sx: { mb: 2 }, children: title }),
6
15
  /* @__PURE__ */ jsx(Typography, { variant: "body1", sx: { mb: 2, textAlign: "center" }, children: description }),
7
16
  /* @__PURE__ */ jsx(Button, { variant: "text", size: "small", component: Link, href: window.blocklet?.appUrl, children: button })
@@ -273,7 +273,8 @@ function CheckoutDonate({
273
273
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
274
274
  sx: {
275
275
  mb: 1,
276
- mt: -2
276
+ mt: -2,
277
+ height: "100%"
277
278
  },
278
279
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_form.default, {
279
280
  id: donation.data.id,
@@ -123,6 +123,9 @@ function CheckoutTable({
123
123
  });
124
124
  }
125
125
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_system.Box, {
126
+ sx: {
127
+ height: "100%"
128
+ },
126
129
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_form.default, {
127
130
  id: hashSessionId || sessionId,
128
131
  mode,
@@ -1,9 +1,11 @@
1
1
  /// <reference types="react" />
2
+ import type { LiteralUnion } from 'type-fest';
3
+ type ModeType = LiteralUnion<'standalone' | 'inline' | 'popup' | 'inline-minimal' | 'popup-minimal', string>;
2
4
  type Props = {
3
5
  title: string;
4
6
  description: string;
5
7
  button?: string;
6
- mode?: string;
8
+ mode?: ModeType;
7
9
  };
8
10
  declare function PaymentError({ title, description, button, mode }: Props): import("react").JSX.Element;
9
11
  declare namespace PaymentError {
@@ -6,16 +6,28 @@ Object.defineProperty(exports, "__esModule", {
6
6
  module.exports = PaymentError;
7
7
  var _jsxRuntime = require("react/jsx-runtime");
8
8
  var _material = require("@mui/material");
9
+ function getHeightStyle(mode) {
10
+ switch (mode) {
11
+ case "standalone":
12
+ return {
13
+ height: "100%"
14
+ };
15
+ default:
16
+ return {
17
+ height: "auto",
18
+ minHeight: 200
19
+ };
20
+ }
21
+ }
9
22
  function PaymentError({
10
23
  title,
11
24
  description,
12
25
  button,
13
26
  mode
14
27
  }) {
28
+ const heightStyle = getHeightStyle(mode);
15
29
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
16
- sx: {
17
- height: mode === "inline" ? "auto" : "100vh"
18
- },
30
+ sx: heightStyle,
19
31
  alignItems: "center",
20
32
  justifyContent: "center",
21
33
  children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/payment-react",
3
- "version": "1.13.277",
3
+ "version": "1.13.281",
4
4
  "description": "Reusable react components for payment kit v2",
5
5
  "keywords": [
6
6
  "react",
@@ -91,7 +91,7 @@
91
91
  "@babel/core": "^7.24.7",
92
92
  "@babel/preset-env": "^7.24.7",
93
93
  "@babel/preset-react": "^7.24.7",
94
- "@blocklet/payment-types": "1.13.277",
94
+ "@blocklet/payment-types": "1.13.281",
95
95
  "@storybook/addon-essentials": "^7.6.19",
96
96
  "@storybook/addon-interactions": "^7.6.19",
97
97
  "@storybook/addon-links": "^7.6.19",
@@ -120,5 +120,5 @@
120
120
  "vite-plugin-babel": "^1.2.0",
121
121
  "vite-plugin-node-polyfills": "^0.21.0"
122
122
  },
123
- "gitHead": "bff3ac5afe035f6dd1a1283e22241c37dac3534c"
123
+ "gitHead": "dea66d4a8bbd397b5a8f8235332349aaca0ab72c"
124
124
  }
@@ -248,7 +248,7 @@ export default function CheckoutDonate({ settings, livemode, timeout, onPaid, on
248
248
  showCloseButton
249
249
  disableEscapeKeyDown
250
250
  onClose={(e: any, reason: string) => setState({ open: reason === 'backdropClick' })}>
251
- <Box sx={{ mb: 1, mt: -2 }}>
251
+ <Box sx={{ mb: 1, mt: -2, height: '100%' }}>
252
252
  <CheckoutForm
253
253
  id={donation.data.id}
254
254
  onPaid={handlePaid}
@@ -102,7 +102,7 @@ export default function CheckoutTable({ id, mode, onPaid, onError, onChange, ext
102
102
  }
103
103
 
104
104
  return (
105
- <Box>
105
+ <Box sx={{ height: '100%' }}>
106
106
  <CheckoutForm
107
107
  id={hashSessionId || sessionId}
108
108
  mode={mode}
@@ -1,15 +1,27 @@
1
1
  import { Button, Link, Stack, Typography } from '@mui/material';
2
+ import type { LiteralUnion } from 'type-fest';
3
+
4
+ type ModeType = LiteralUnion<'standalone' | 'inline' | 'popup' | 'inline-minimal' | 'popup-minimal', string>;
2
5
 
3
6
  type Props = {
4
7
  title: string;
5
8
  description: string;
6
9
  button?: string;
7
- mode?: string;
10
+ mode?: ModeType;
8
11
  };
9
12
 
13
+ function getHeightStyle(mode: ModeType | undefined): any {
14
+ switch (mode) {
15
+ case 'standalone':
16
+ return { height: '100%' }; // 独立模式下,高度为100vh
17
+ default:
18
+ return { height: 'auto', minHeight: 200 }; // 默认情况下,高度根据内容自动调整
19
+ }
20
+ }
10
21
  export default function PaymentError({ title, description, button, mode }: Props) {
22
+ const heightStyle = getHeightStyle(mode);
11
23
  return (
12
- <Stack sx={{ height: mode === 'inline' ? 'auto' : '100vh' }} alignItems="center" justifyContent="center">
24
+ <Stack sx={heightStyle} alignItems="center" justifyContent="center">
13
25
  <Stack sx={{ width: '280px' }} direction="column" alignItems="center" justifyContent="center">
14
26
  <Typography variant="h5" sx={{ mb: 2 }}>
15
27
  {title}