@blocklet/payment-react 1.14.22 → 1.14.23

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.
package/es/theme/index.js CHANGED
@@ -1,243 +1,256 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { ThemeProvider, useTheme } from "@mui/material/styles";
3
3
  import { create } from "@arcblock/ux/lib/Theme";
4
- import { CssBaseline } from "@mui/material";
4
+ import { cloneDeep, merge } from "lodash";
5
+ import { Box, CssBaseline } from "@mui/material";
5
6
  import { typography } from "./typography.js";
6
7
  import "./index.css";
7
8
  export { typography };
8
- export const themeOverrides = {
9
- shape: {
10
- borderRadius: 8
11
- },
12
- components: {
13
- MuiOutlinedInput: {
14
- styleOverrides: {
15
- root: {
16
- borderRadius: "var(--radius-m, 8px)",
17
- backgroundColor: "var(--backgrounds-bg-field)",
18
- "&.Mui-disabled": {
19
- backgroundColor: "var(--backgrounds-bg-disabled)"
20
- },
21
- ".MuiOutlinedInput-notchedOutline": {
22
- borderColor: "var(--stroke-border-base, #EFF1F5)"
23
- },
24
- ".MuiInputBase-input": {
25
- fontSize: "14px",
26
- minHeight: "1.65em",
27
- lineHeight: "1.65em"
9
+ PaymentThemeProvider.defaultProps = {
10
+ theme: {}
11
+ };
12
+ export function PaymentThemeProvider({
13
+ children,
14
+ theme: customTheme = {}
15
+ }) {
16
+ const { sx: themeSX = {}, ...restTheme } = customTheme || {};
17
+ const parentTheme = useTheme();
18
+ const rootStyle = getComputedStyle(document.documentElement);
19
+ const themeOverrides = {
20
+ shape: {
21
+ borderRadius: 8
22
+ },
23
+ components: {
24
+ MuiOutlinedInput: {
25
+ styleOverrides: {
26
+ root: {
27
+ borderRadius: "var(--radius-m, 8px)",
28
+ backgroundColor: "var(--backgrounds-bg-field)",
29
+ "&.Mui-disabled": {
30
+ backgroundColor: "var(--backgrounds-bg-disabled)"
31
+ },
32
+ ".MuiOutlinedInput-notchedOutline": {
33
+ borderColor: "var(--stroke-border-base, #EFF1F5)"
34
+ },
35
+ ".MuiInputBase-input": {
36
+ fontSize: "14px",
37
+ minHeight: "1.65em",
38
+ lineHeight: "1.65em"
39
+ }
28
40
  }
29
41
  }
30
- }
31
- },
32
- MuiButton: {
33
- defaultProps: {
34
- size: "small"
35
42
  },
36
- styleOverrides: {
37
- root: {
38
- fontSize: "1rem",
39
- fontWeight: 500,
40
- textTransform: "none"
43
+ MuiButton: {
44
+ defaultProps: {
45
+ size: "small"
41
46
  },
42
- containedPrimary: {
43
- backgroundColor: "var(--buttons-button-inverted, #010714)",
44
- color: "var(--foregrounds-fg-on-color, #fff)",
45
- "&:hover": {
46
- backgroundColor: "var(--buttons-button-inverted-hover, #1f2937)"
47
+ styleOverrides: {
48
+ root: {
49
+ fontSize: "1rem",
50
+ fontWeight: 500,
51
+ textTransform: "none"
52
+ },
53
+ containedPrimary: {
54
+ backgroundColor: "var(--buttons-button-inverted, #010714)",
55
+ color: "var(--foregrounds-fg-on-color, #fff)",
56
+ "&:hover": {
57
+ backgroundColor: "var(--buttons-button-inverted-hover, #1f2937)"
58
+ }
59
+ },
60
+ outlinedPrimary: {
61
+ color: "var(--foregrounds-fg-base, #010714)",
62
+ borderColor: "var(--stroke-button-secondary-border, #E5E7EB)",
63
+ "&:hover": {
64
+ backgroundColor: "var(--buttons-button-neutral-hover, #F3F4F6)",
65
+ borderColor: "var(--stroke-button-secondary-border, #E5E7EB)"
66
+ }
67
+ },
68
+ sizeSmall: {
69
+ height: 32
47
70
  }
71
+ }
72
+ },
73
+ MuiIconButton: {
74
+ defaultProps: {
75
+ size: "small"
48
76
  },
49
- outlinedPrimary: {
50
- color: "var(--foregrounds-fg-base, #010714)",
51
- borderColor: "var(--stroke-button-secondary-border, #E5E7EB)",
52
- "&:hover": {
53
- backgroundColor: "var(--buttons-button-neutral-hover, #F3F4F6)",
54
- borderColor: "var(--stroke-button-secondary-border, #E5E7EB)"
77
+ styleOverrides: {
78
+ root: {
79
+ textTransform: "none"
80
+ },
81
+ colorPrimary: {
82
+ backgroundColor: "#fff"
55
83
  }
56
- },
57
- sizeSmall: {
58
- height: 32
59
84
  }
60
- }
61
- },
62
- MuiIconButton: {
63
- defaultProps: {
64
- size: "small"
65
85
  },
66
- styleOverrides: {
67
- root: {
68
- textTransform: "none"
69
- },
70
- colorPrimary: {
71
- backgroundColor: "#fff"
86
+ MuiToggleButton: {
87
+ styleOverrides: {
88
+ root: {
89
+ textTransform: "none"
90
+ }
72
91
  }
73
- }
74
- },
75
- MuiToggleButton: {
76
- styleOverrides: {
77
- root: {
78
- textTransform: "none"
92
+ },
93
+ MuiTab: {
94
+ styleOverrides: {
95
+ root: {
96
+ textTransform: "none"
97
+ }
79
98
  }
80
- }
81
- },
82
- MuiTab: {
83
- styleOverrides: {
84
- root: {
85
- textTransform: "none"
99
+ },
100
+ MuiTooltip: {
101
+ defaultProps: {
102
+ enterTouchDelay: 3e3,
103
+ leaveTouchDelay: 100
86
104
  }
87
- }
88
- },
89
- MuiTooltip: {
90
- defaultProps: {
91
- enterTouchDelay: 3e3,
92
- leaveTouchDelay: 100
93
- }
94
- },
95
- MuiPopover: {
96
- styleOverrides: {
97
- paper: ({ theme }) => ({
98
- border: `1px solid ${theme.palette.divider}`,
99
- boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)"
100
- })
101
- }
102
- },
103
- MuiCssBaseline: {
104
- styleOverrides: {
105
- ".base-card": {
106
- padding: "20px",
107
- borderRadius: "var(--radius-l)",
108
- background: "var(--backgrounds-bg-base)",
109
- boxShadow: "0px 0px 0px 1px var(--shadows-card-rest-1, rgba(2, 7, 19, 0.08)), 0px 1px 2px -1px var(--shadows-card-rest-2, rgba(2, 7, 19, 0.08)), 0px 2px 4px 0px var(--shadows-card-rest-3, rgba(2, 7, 19, 0.04))"
110
- },
111
- ".base-label": {
112
- color: "var(--foregrounds-fg-base, #010714)",
113
- fontSize: "16px",
114
- fontWeight: "500",
115
- lineHeight: "24px"
116
- },
117
- a: {
118
- textDecoration: "none !important"
105
+ },
106
+ MuiPopover: {
107
+ styleOverrides: {
108
+ paper: ({ theme }) => ({
109
+ border: `1px solid ${theme.palette.divider}`,
110
+ boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1)"
111
+ })
119
112
  }
120
- }
121
- },
122
- // MuiButtonBase: {
123
- // styleOverrides: {
124
- // }
125
- // },
126
- MuiRadio: {
127
- styleOverrides: {
128
- root: {
129
- color: "var(--stroke-border-base, #EFF1F5)",
130
- "&:hover": {
131
- background: "none"
113
+ },
114
+ MuiCssBaseline: {
115
+ styleOverrides: {
116
+ ".base-card": {
117
+ padding: "20px",
118
+ borderRadius: "var(--radius-l)",
119
+ background: "var(--backgrounds-bg-base)",
120
+ boxShadow: "0px 0px 0px 1px var(--shadows-card-rest-1, rgba(2, 7, 19, 0.08)), 0px 1px 2px -1px var(--shadows-card-rest-2, rgba(2, 7, 19, 0.08)), 0px 2px 4px 0px var(--shadows-card-rest-3, rgba(2, 7, 19, 0.04))"
132
121
  },
133
- "&.Mui-checked": {
134
- color: "var(--foregrounds-fg-interactive, #0086FF)"
122
+ ".base-label": {
123
+ color: "var(--foregrounds-fg-base, #010714)",
124
+ fontSize: "16px",
125
+ fontWeight: "500",
126
+ lineHeight: "24px"
127
+ },
128
+ a: {
129
+ textDecoration: "none !important"
135
130
  }
136
131
  }
137
- }
138
- },
139
- MuiCheckbox: {
140
- styleOverrides: {
141
- root: {
142
- color: "var(--backgrounds-bg-interactive, #0086FF)",
143
- "&.Mui-checked": {
144
- color: "var(--foregrounds-fg-interactive, #0086FF)"
132
+ },
133
+ // MuiButtonBase: {
134
+ // styleOverrides: {
135
+ // }
136
+ // },
137
+ MuiRadio: {
138
+ styleOverrides: {
139
+ root: {
140
+ color: "var(--stroke-border-base, #EFF1F5)",
141
+ "&:hover": {
142
+ background: "none"
143
+ },
144
+ "&.Mui-checked": {
145
+ color: "var(--foregrounds-fg-interactive, #0086FF)"
146
+ }
145
147
  }
146
148
  }
147
- }
148
- },
149
- MuiDivider: {
150
- styleOverrides: {
151
- root: {
152
- borderColor: "var(--stroke-border-base, #EFF1F5)"
153
- }
154
- }
155
- },
156
- MuiInputBase: {
157
- defaultProps: {
158
- size: "small"
159
149
  },
160
- styleOverrides: {
161
- root: () => ({
162
- fontSize: "0.875rem",
163
- backgroundColor: "var(--backgrounds-bg-field, #F9FAFB)"
164
- })
165
- }
166
- },
167
- MuiInputLabel: {
168
- defaultProps: {
169
- size: "small"
150
+ MuiCheckbox: {
151
+ styleOverrides: {
152
+ root: {
153
+ color: "var(--backgrounds-bg-interactive, #0086FF)",
154
+ "&.Mui-checked": {
155
+ color: "var(--foregrounds-fg-interactive, #0086FF)"
156
+ }
157
+ }
158
+ }
170
159
  },
171
- styleOverrides: {
172
- root: () => ({
173
- fontSize: "0.875rem"
174
- })
175
- }
176
- },
177
- MuiChip: {
178
- styleOverrides: {
179
- root: {
180
- borderRadius: "var(--radius-S, 4px)",
181
- border: "1px solid transparent",
182
- "&.MuiChip-filledSuccess": {
183
- color: "var(--tags-tag-green-text, #007C52)",
184
- backgroundColor: "var(--tags-tag-green-bg, #B7FEE3)",
185
- borderColor: "var(--tags-tag-green-border, #63F9CB)"
186
- },
187
- "&.MuiChip-filledDefault": {
188
- color: "var(--tags-tag-neutral-text, #007C52)",
189
- backgroundColor: "var(--tags-tag-neutral-bg, #B7FEE3)",
190
- borderColor: "var(--tags-tag-neutral-border, #E5E7EB)"
191
- },
192
- "&.MuiChip-filledSecondary": {
193
- color: "var(--tags-tag-purple-text, #8118EB)",
194
- backgroundColor: " var(--tags-tag-purple-bg, #EFE9FF)",
195
- borderColor: "var(--tags-tag-purple-border, #E1D6FF)"
196
- },
197
- "&.MuiChip-filledError": {
198
- color: "var(--tags-tag-red-text, #E40031)",
199
- backgroundColor: "var(--tags-tag-red-bg, #FFE2E6)",
200
- borderColor: "var(--tags-tag-red-border, #FFC8D3)"
201
- },
202
- "&.MuiChip-filledWarning": {
203
- color: "var(--tags-tag-orange-text, #D24000)",
204
- backgroundColor: "var(--tags-tag-orange-bg, #FFF4BC)",
205
- borderColor: "var(--tags-tag-orange-border, #FFE467)"
206
- },
207
- "&.MuiChip-filledPrimary,&.MuiChip-filledInfo": {
208
- color: "var(--tags-tag-blue-text, #0051E9)",
209
- backgroundColor: "var(--tags-tag-blue-bg, #D2ECFF)",
210
- borderColor: "var(--tags-tag-blue-border, #AFDDFF)"
160
+ MuiDivider: {
161
+ styleOverrides: {
162
+ root: {
163
+ borderColor: "var(--stroke-border-base, #EFF1F5)"
211
164
  }
212
165
  }
213
- }
214
- }
215
- }
216
- };
217
- export function PaymentThemeProvider({ children }) {
218
- const theme = useTheme();
219
- const rootStyle = getComputedStyle(document.documentElement);
220
- const merged = create({
221
- ...theme,
222
- typography,
223
- palette: {
224
- primary: {
225
- main: rootStyle.getPropertyValue("--foregrounds-fg-base").trim() || "#030712"
226
166
  },
227
- text: {
228
- primary: rootStyle.getPropertyValue("--foregrounds-fg-base").trim() || "#030712",
229
- secondary: rootStyle.getPropertyValue("--foregrounds-fg-subtle").trim() || "#4b5563",
230
- lighter: rootStyle.getPropertyValue("--foregrounds-fg-muted").trim() || "#9ca3af",
231
- link: rootStyle.getPropertyValue("--foregrounds-fg-interactive").trim() || "#0086FF"
167
+ MuiInputBase: {
168
+ defaultProps: {
169
+ size: "small"
170
+ },
171
+ styleOverrides: {
172
+ root: () => ({
173
+ fontSize: "0.875rem",
174
+ backgroundColor: "var(--backgrounds-bg-field, #F9FAFB)"
175
+ })
176
+ }
232
177
  },
233
- error: {
234
- main: rootStyle.getPropertyValue("--foregrounds-fg-danger").trim() || "#FF003B"
178
+ MuiInputLabel: {
179
+ defaultProps: {
180
+ size: "small"
181
+ },
182
+ styleOverrides: {
183
+ root: () => ({
184
+ fontSize: "0.875rem"
185
+ })
186
+ }
187
+ },
188
+ MuiChip: {
189
+ styleOverrides: {
190
+ root: {
191
+ borderRadius: "var(--radius-S, 4px)",
192
+ border: "1px solid transparent",
193
+ "&.MuiChip-filledSuccess": {
194
+ color: "var(--tags-tag-green-text, #007C52)",
195
+ backgroundColor: "var(--tags-tag-green-bg, #B7FEE3)",
196
+ borderColor: "var(--tags-tag-green-border, #63F9CB)"
197
+ },
198
+ "&.MuiChip-filledDefault": {
199
+ color: "var(--tags-tag-neutral-text, #007C52)",
200
+ backgroundColor: "var(--tags-tag-neutral-bg, #B7FEE3)",
201
+ borderColor: "var(--tags-tag-neutral-border, #E5E7EB)"
202
+ },
203
+ "&.MuiChip-filledSecondary": {
204
+ color: "var(--tags-tag-purple-text, #8118EB)",
205
+ backgroundColor: " var(--tags-tag-purple-bg, #EFE9FF)",
206
+ borderColor: "var(--tags-tag-purple-border, #E1D6FF)"
207
+ },
208
+ "&.MuiChip-filledError": {
209
+ color: "var(--tags-tag-red-text, #E40031)",
210
+ backgroundColor: "var(--tags-tag-red-bg, #FFE2E6)",
211
+ borderColor: "var(--tags-tag-red-border, #FFC8D3)"
212
+ },
213
+ "&.MuiChip-filledWarning": {
214
+ color: "var(--tags-tag-orange-text, #D24000)",
215
+ backgroundColor: "var(--tags-tag-orange-bg, #FFF4BC)",
216
+ borderColor: "var(--tags-tag-orange-border, #FFE467)"
217
+ },
218
+ "&.MuiChip-filledPrimary,&.MuiChip-filledInfo": {
219
+ color: "var(--tags-tag-blue-text, #0051E9)",
220
+ backgroundColor: "var(--tags-tag-blue-bg, #D2ECFF)",
221
+ borderColor: "var(--tags-tag-blue-border, #AFDDFF)"
222
+ }
223
+ }
224
+ }
235
225
  }
236
- },
237
- ...themeOverrides
238
- });
239
- return /* @__PURE__ */ jsxs(ThemeProvider, { theme: merged, children: [
226
+ }
227
+ };
228
+ const mergeTheme = create(
229
+ merge(
230
+ cloneDeep({
231
+ ...parentTheme,
232
+ typography,
233
+ palette: {
234
+ primary: {
235
+ main: rootStyle.getPropertyValue("--foregrounds-fg-base").trim() || "#030712"
236
+ },
237
+ text: {
238
+ primary: rootStyle.getPropertyValue("--foregrounds-fg-base").trim() || "#030712",
239
+ secondary: rootStyle.getPropertyValue("--foregrounds-fg-subtle").trim() || "#4b5563",
240
+ lighter: rootStyle.getPropertyValue("--foregrounds-fg-muted").trim() || "#9ca3af",
241
+ link: rootStyle.getPropertyValue("--foregrounds-fg-interactive").trim() || "#0086FF"
242
+ },
243
+ error: {
244
+ main: rootStyle.getPropertyValue("--foregrounds-fg-danger").trim() || "#FF003B"
245
+ }
246
+ },
247
+ ...themeOverrides
248
+ }),
249
+ restTheme
250
+ )
251
+ );
252
+ return /* @__PURE__ */ jsxs(ThemeProvider, { theme: mergeTheme, children: [
240
253
  /* @__PURE__ */ jsx(CssBaseline, {}),
241
- children
254
+ /* @__PURE__ */ jsx(Box, { sx: { height: "100%", ...themeSX }, children })
242
255
  ] });
243
256
  }
@@ -1,4 +1,5 @@
1
1
  import type { TCheckoutSessionExpanded, TCustomer, TPaymentIntent, TPaymentLink, TPaymentMethodExpanded } from '@blocklet/payment-types';
2
+ import { SxProps, ThemeOptions } from '@mui/material';
2
3
  import { LiteralUnion } from 'type-fest';
3
4
  export type CheckoutContext = {
4
5
  checkoutSession: TCheckoutSessionExpanded;
@@ -8,6 +9,7 @@ export type CheckoutContext = {
8
9
  customer?: TCustomer;
9
10
  mode: LiteralUnion<'standalone' | 'inline' | 'popup', string>;
10
11
  action?: string;
12
+ showCheckoutSummary?: boolean;
11
13
  };
12
14
  export type CheckoutFormData = {
13
15
  customer_name: string;
@@ -24,12 +26,15 @@ export type CheckoutFormData = {
24
26
  postal_code: string;
25
27
  };
26
28
  };
29
+ export type PaymentThemeOptions = ThemeOptions & {
30
+ sx?: SxProps;
31
+ };
27
32
  export type CheckoutProps = Partial<CheckoutCallbacks> & {
28
33
  id: string;
29
34
  extraParams?: Record<string, any>;
30
35
  action?: string;
31
36
  mode?: LiteralUnion<'standalone' | 'inline' | 'popup' | 'inline-minimal' | 'popup-minimal', string>;
32
- customTheme?: boolean;
37
+ theme?: 'default' | 'inherit' | PaymentThemeOptions;
33
38
  };
34
39
  export type CheckoutCallbacks = {
35
40
  onPaid: (res: CheckoutContext) => void;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { DonationSettings, TCheckoutSessionExpanded, TPaymentCurrency, TPaymentMethod } from '@blocklet/payment-types';
3
3
  import { ButtonProps as MUIButtonProps } from '@mui/material';
4
- import { CheckoutProps } from '../types';
4
+ import { CheckoutProps, PaymentThemeOptions } from '../types';
5
5
  export type DonateHistory = {
6
6
  supporters: TCheckoutSessionExpanded[];
7
7
  currency: TPaymentCurrency;
@@ -20,11 +20,12 @@ export type DonateProps = Pick<CheckoutProps, 'onPaid' | 'onError'> & {
20
20
  inlineOptions?: {
21
21
  button?: ButtonType;
22
22
  };
23
- customTheme?: boolean;
23
+ theme?: 'default' | 'inherit' | PaymentThemeOptions;
24
24
  };
25
25
  declare function CheckoutDonate(props: DonateProps): import("react").JSX.Element;
26
26
  declare namespace CheckoutDonate {
27
27
  var defaultProps: {
28
+ theme: string;
28
29
  livemode: boolean;
29
30
  timeout: number;
30
31
  mode: string;
@@ -466,11 +466,19 @@ function CheckoutDonateInner({
466
466
  });
467
467
  }
468
468
  function CheckoutDonate(props) {
469
- if (props.customTheme) {
469
+ if (props.theme === "inherit") {
470
470
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(CheckoutDonateInner, {
471
471
  ...props
472
472
  });
473
473
  }
474
+ if (props.theme && typeof props.theme === "object") {
475
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_theme.PaymentThemeProvider, {
476
+ theme: props.theme,
477
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(CheckoutDonateInner, {
478
+ ...props
479
+ })
480
+ });
481
+ }
474
482
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_theme.PaymentThemeProvider, {
475
483
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(CheckoutDonateInner, {
476
484
  ...props
@@ -478,6 +486,7 @@ function CheckoutDonate(props) {
478
486
  });
479
487
  }
480
488
  CheckoutDonate.defaultProps = {
489
+ theme: "default",
481
490
  livemode: true,
482
491
  timeout: 5e3,
483
492
  mode: "default",
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { CheckoutProps } from '../types';
3
- declare function CheckoutForm({ id, mode, onPaid, onError, onChange, goBack, extraParams, action, customTheme, }: CheckoutProps): import("react").JSX.Element;
3
+ declare function CheckoutForm({ id, mode, onPaid, onError, onChange, goBack, extraParams, action, theme, ...restProps }: CheckoutProps): import("react").JSX.Element;
4
4
  declare namespace CheckoutForm {
5
5
  var defaultProps: {
6
6
  onPaid: any;
@@ -40,7 +40,8 @@ function CheckoutForm({
40
40
  goBack,
41
41
  extraParams,
42
42
  action,
43
- customTheme = false
43
+ theme = "default",
44
+ ...restProps
44
45
  }) {
45
46
  if (!id.startsWith("plink_") && !id.startsWith("cs_")) {
46
47
  throw new Error("Either a checkoutSession or a paymentLink id is required.");
@@ -72,8 +73,27 @@ function CheckoutForm({
72
73
  });
73
74
  onError?.(err);
74
75
  };
75
- if (!customTheme) {
76
+ if (theme === "inherit") {
77
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_payment.default, {
78
+ checkoutSession: data?.checkoutSession,
79
+ paymentMethods: data?.paymentMethods,
80
+ paymentIntent: data?.paymentIntent,
81
+ paymentLink: data?.paymentLink,
82
+ customer: data?.customer,
83
+ completed: state.completed,
84
+ error: apiError || state.appError,
85
+ onPaid: handlePaid,
86
+ onError: handleError,
87
+ onChange,
88
+ goBack,
89
+ mode,
90
+ action,
91
+ ...restProps
92
+ });
93
+ }
94
+ if (theme && typeof theme === "object") {
76
95
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_theme.PaymentThemeProvider, {
96
+ theme,
77
97
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_payment.default, {
78
98
  checkoutSession: data?.checkoutSession,
79
99
  paymentMethods: data?.paymentMethods,
@@ -87,24 +107,28 @@ function CheckoutForm({
87
107
  onChange,
88
108
  goBack,
89
109
  mode,
90
- action
110
+ action,
111
+ ...restProps
91
112
  })
92
113
  });
93
114
  }
94
- return /* @__PURE__ */(0, _jsxRuntime.jsx)(_payment.default, {
95
- checkoutSession: data?.checkoutSession,
96
- paymentMethods: data?.paymentMethods,
97
- paymentIntent: data?.paymentIntent,
98
- paymentLink: data?.paymentLink,
99
- customer: data?.customer,
100
- completed: state.completed,
101
- error: apiError || state.appError,
102
- onPaid: handlePaid,
103
- onError: handleError,
104
- onChange,
105
- goBack,
106
- mode,
107
- action
115
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_theme.PaymentThemeProvider, {
116
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_payment.default, {
117
+ checkoutSession: data?.checkoutSession,
118
+ paymentMethods: data?.paymentMethods,
119
+ paymentIntent: data?.paymentIntent,
120
+ paymentLink: data?.paymentLink,
121
+ customer: data?.customer,
122
+ completed: state.completed,
123
+ error: apiError || state.appError,
124
+ onPaid: handlePaid,
125
+ onError: handleError,
126
+ onChange,
127
+ goBack,
128
+ mode,
129
+ action,
130
+ ...restProps
131
+ })
108
132
  });
109
133
  }
110
134
  CheckoutForm.defaultProps = {
@@ -148,11 +148,19 @@ function CheckoutTableInner({
148
148
  });
149
149
  }
150
150
  function CheckoutTable(props) {
151
- if (props.customTheme) {
151
+ if (props.theme === "inherit") {
152
152
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(CheckoutTableInner, {
153
153
  ...props
154
154
  });
155
155
  }
156
+ if (props.theme && typeof props.theme === "object") {
157
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(_theme.PaymentThemeProvider, {
158
+ theme: props.theme,
159
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(CheckoutTableInner, {
160
+ ...props
161
+ })
162
+ });
163
+ }
156
164
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_theme.PaymentThemeProvider, {
157
165
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(CheckoutTableInner, {
158
166
  ...props