@blocklet/payment-react 1.14.22 → 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.
package/README.md CHANGED
@@ -68,3 +68,80 @@ import zh from './zh';
68
68
  // eslint-disable-next-line import/prefer-default-export
69
69
  export const translations = merge({ zh, en }, extraTranslations);
70
70
  ```
71
+
72
+ ## Updates
73
+
74
+ #### theme
75
+ Since version 1.14.22, the component includes a built-in theme provider. If you need to modify the styles of internal components, you need to pass the `theme` property to override or inherit the external theme.
76
+
77
+ | option |description |
78
+ | --- | --- |
79
+ | default [default value] | wrapped with built-in PaymentThemeProvider |
80
+ | inherit | use the parent component's themeProvider |
81
+ | PaymentThemeOptions | override some styles of PaymentThemeProvider |
82
+
83
+ ```ts
84
+ export type PaymentThemeOptions = ThemeOptions & {
85
+ sx?: SxProps;
86
+ };
87
+
88
+ ```
89
+ ```js
90
+ // 1. use themeOptions
91
+ <CheckoutForm
92
+ id="plink_oB1I6FNeHKSkuq81fhJy0vIZ"
93
+ onChange={console.info}
94
+ theme={{
95
+ components: {
96
+ MuiButton: {
97
+ styleOverrides: {
98
+ containedPrimary: {
99
+ backgroundColor: '#1DC1C7',
100
+ color: '#fff',
101
+ '&:hover': {
102
+ backgroundColor: 'rgb(20, 135, 139)',
103
+ },
104
+ },
105
+ },
106
+ },
107
+ },
108
+ }}
109
+ />
110
+
111
+ // 2. use theme sx
112
+ <CheckoutForm
113
+ id="plink_oB1I6FNeHKSkuq81fhJy0vIZ"
114
+ mode="inline-minimal"
115
+ onChange={console.info}
116
+ theme={{
117
+ sx: {
118
+ '.cko-submit-button': {
119
+ backgroundColor: '#1DC1C7',
120
+ color: '#fff',
121
+ '&:hover': {
122
+ backgroundColor: 'rgb(20, 135, 139)',
123
+ },
124
+ },
125
+ },
126
+ }}
127
+ />
128
+ ```
129
+
130
+ #### showCheckoutSummary
131
+
132
+ Since version 1.14.23, if you need to hide the product column, we recommend using `showCheckoutSummary=false` instead of `mode=inline-minimal`. We aim for better semantics.
133
+ ```js
134
+ // bad
135
+ <CheckoutForm
136
+ id="plink_oB1I6FNeHKSkuq81fhJy0vIZ"
137
+ mode="inline-minimal"
138
+ onChange={console.info}
139
+ />
140
+
141
+ // good
142
+ <CheckoutForm
143
+ id="plink_oB1I6FNeHKSkuq81fhJy0vIZ"
144
+ showCheckoutSummary={false}
145
+ onChange={console.info}
146
+ />
147
+ ```
@@ -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;
@@ -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
  }
@@ -356,12 +379,16 @@ function CheckoutDonateInner({ settings, livemode, timeout, onPaid, onError, mod
356
379
  ] });
357
380
  }
358
381
  export default function CheckoutDonate(props) {
359
- if (props.customTheme) {
382
+ if (props.theme === "inherit") {
360
383
  return /* @__PURE__ */ jsx(CheckoutDonateInner, { ...props });
361
384
  }
385
+ if (props.theme && typeof props.theme === "object") {
386
+ return /* @__PURE__ */ jsx(PaymentThemeProvider, { theme: props.theme, children: /* @__PURE__ */ jsx(CheckoutDonateInner, { ...props }) });
387
+ }
362
388
  return /* @__PURE__ */ jsx(PaymentThemeProvider, { children: /* @__PURE__ */ jsx(CheckoutDonateInner, { ...props }) });
363
389
  }
364
390
  CheckoutDonate.defaultProps = {
391
+ theme: "default",
365
392
  livemode: true,
366
393
  timeout: 5e3,
367
394
  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;
@@ -31,7 +31,8 @@ export default function CheckoutForm({
31
31
  goBack,
32
32
  extraParams,
33
33
  action,
34
- customTheme = false
34
+ theme = "default",
35
+ ...restProps
35
36
  }) {
36
37
  if (!id.startsWith("plink_") && !id.startsWith("cs_")) {
37
38
  throw new Error("Either a checkoutSession or a paymentLink id is required.");
@@ -59,8 +60,8 @@ export default function CheckoutForm({
59
60
  setState({ appError: err });
60
61
  onError?.(err);
61
62
  };
62
- if (!customTheme) {
63
- return /* @__PURE__ */ jsx(PaymentThemeProvider, { children: /* @__PURE__ */ jsx(
63
+ if (theme === "inherit") {
64
+ return /* @__PURE__ */ jsx(
64
65
  Payment,
65
66
  {
66
67
  checkoutSession: data?.checkoutSession,
@@ -75,11 +76,33 @@ export default function CheckoutForm({
75
76
  onChange,
76
77
  goBack,
77
78
  mode,
78
- action
79
+ action,
80
+ ...restProps
81
+ }
82
+ );
83
+ }
84
+ if (theme && typeof theme === "object") {
85
+ return /* @__PURE__ */ jsx(PaymentThemeProvider, { theme, children: /* @__PURE__ */ jsx(
86
+ Payment,
87
+ {
88
+ checkoutSession: data?.checkoutSession,
89
+ paymentMethods: data?.paymentMethods,
90
+ paymentIntent: data?.paymentIntent,
91
+ paymentLink: data?.paymentLink,
92
+ customer: data?.customer,
93
+ completed: state.completed,
94
+ error: apiError || state.appError,
95
+ onPaid: handlePaid,
96
+ onError: handleError,
97
+ onChange,
98
+ goBack,
99
+ mode,
100
+ action,
101
+ ...restProps
79
102
  }
80
103
  ) });
81
104
  }
82
- return /* @__PURE__ */ jsx(
105
+ return /* @__PURE__ */ jsx(PaymentThemeProvider, { children: /* @__PURE__ */ jsx(
83
106
  Payment,
84
107
  {
85
108
  checkoutSession: data?.checkoutSession,
@@ -94,9 +117,10 @@ export default function CheckoutForm({
94
117
  onChange,
95
118
  goBack,
96
119
  mode,
97
- action
120
+ action,
121
+ ...restProps
98
122
  }
99
- );
123
+ ) });
100
124
  }
101
125
  CheckoutForm.defaultProps = {
102
126
  onPaid: noop,
@@ -111,8 +111,11 @@ function CheckoutTableInner({ id, mode, onPaid, onError, onChange, extraParams,
111
111
  ) });
112
112
  }
113
113
  export default function CheckoutTable(props) {
114
- if (props.customTheme) {
114
+ if (props.theme === "inherit") {
115
115
  return /* @__PURE__ */ jsx(CheckoutTableInner, { ...props });
116
116
  }
117
+ if (props.theme && typeof props.theme === "object") {
118
+ return /* @__PURE__ */ jsx(PaymentThemeProvider, { theme: props.theme, children: /* @__PURE__ */ jsx(CheckoutTableInner, { ...props }) });
119
+ }
117
120
  return /* @__PURE__ */ jsx(PaymentThemeProvider, { children: /* @__PURE__ */ jsx(CheckoutTableInner, { ...props }) });
118
121
  }
@@ -4,21 +4,21 @@ declare const FormInput: import("react").ForwardRefExoticComponent<(Omit<import(
4
4
  name: string;
5
5
  label?: string | undefined;
6
6
  placeholder?: string | undefined;
7
- errorPosition?: "right" | "bottom" | undefined;
7
+ errorPosition?: "bottom" | "right" | undefined;
8
8
  rules?: RegisterOptions<import("react-hook-form").FieldValues, string> | undefined;
9
9
  wrapperStyle?: any;
10
10
  }, "ref"> | Omit<import("@mui/material").FilledTextFieldProps & {
11
11
  name: string;
12
12
  label?: string | undefined;
13
13
  placeholder?: string | undefined;
14
- errorPosition?: "right" | "bottom" | undefined;
14
+ errorPosition?: "bottom" | "right" | undefined;
15
15
  rules?: RegisterOptions<import("react-hook-form").FieldValues, string> | undefined;
16
16
  wrapperStyle?: any;
17
17
  }, "ref"> | Omit<import("@mui/material").StandardTextFieldProps & {
18
18
  name: string;
19
19
  label?: string | undefined;
20
20
  placeholder?: string | undefined;
21
- errorPosition?: "right" | "bottom" | undefined;
21
+ errorPosition?: "bottom" | "right" | undefined;
22
22
  rules?: RegisterOptions<import("react-hook-form").FieldValues, string> | undefined;
23
23
  wrapperStyle?: any;
24
24
  }, "ref">) & import("react").RefAttributes<HTMLInputElement>>;
package/es/libs/util.d.ts CHANGED
@@ -24,12 +24,12 @@ export declare function formatLineItemPricing(item: TLineItemExpanded, currency:
24
24
  secondary?: string;
25
25
  quantity: string;
26
26
  };
27
- export declare function getSubscriptionStatusColor(status: string): "success" | "primary" | "warning" | "error" | "default";
28
- export declare function getPaymentIntentStatusColor(status: string): "success" | "warning" | "default";
29
- export declare function getRefundStatusColor(status: string): "success" | "warning" | "default";
30
- export declare function getPayoutStatusColor(status: string): "success" | "warning" | "default";
31
- export declare function getInvoiceStatusColor(status: string): "success" | "warning" | "default" | "secondary";
32
- export declare function getWebhookStatusColor(status: string): "success" | "default";
27
+ export declare function getSubscriptionStatusColor(status: string): "default" | "success" | "primary" | "warning" | "error";
28
+ export declare function getPaymentIntentStatusColor(status: string): "default" | "success" | "warning";
29
+ export declare function getRefundStatusColor(status: string): "default" | "success" | "warning";
30
+ export declare function getPayoutStatusColor(status: string): "default" | "success" | "warning";
31
+ export declare function getInvoiceStatusColor(status: string): "default" | "success" | "warning" | "secondary";
32
+ export declare function getWebhookStatusColor(status: string): "default" | "success";
33
33
  export declare function getCheckoutAmount(items: TLineItemExpanded[], currency: TPaymentCurrency, trialing?: boolean, upsell?: boolean): {
34
34
  subtotal: any;
35
35
  total: any;
@@ -4,12 +4,14 @@ import { CheckoutCallbacks, CheckoutContext } from '../types';
4
4
  type Props = CheckoutContext & CheckoutCallbacks & {
5
5
  completed?: boolean;
6
6
  error?: any;
7
+ showCheckoutSummary?: boolean;
7
8
  };
8
- declare function Payment({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, completed, mode, onPaid, onError, onChange, goBack, action, }: Props): import("react").JSX.Element;
9
+ declare function Payment({ checkoutSession, paymentMethods, paymentIntent, paymentLink, customer, completed, mode, onPaid, onError, onChange, goBack, action, showCheckoutSummary, }: Props): import("react").JSX.Element;
9
10
  declare namespace Payment {
10
11
  var defaultProps: {
11
12
  completed: boolean;
12
13
  error: null;
14
+ showCheckoutSummary: boolean;
13
15
  };
14
16
  }
15
17
  export default Payment;
@@ -21,7 +21,8 @@ import PaymentSuccess from "./success.js";
21
21
  import PaymentSummary from "./summary.js";
22
22
  import { useMobile } from "../hooks/mobile.js";
23
23
  PaymentInner.defaultProps = {
24
- completed: false
24
+ completed: false,
25
+ showCheckoutSummary: true
25
26
  };
26
27
  function PaymentInner({
27
28
  checkoutSession,
@@ -34,7 +35,8 @@ function PaymentInner({
34
35
  onPaid,
35
36
  onError,
36
37
  onChange,
37
- action
38
+ action,
39
+ showCheckoutSummary = true
38
40
  }) {
39
41
  const { t } = useLocaleContext();
40
42
  const { settings, session } = usePaymentContext();
@@ -42,6 +44,7 @@ function PaymentInner({
42
44
  const [state, setState] = useSetState({ checkoutSession });
43
45
  const defaultCurrencyId = state.checkoutSession.currency_id || state.checkoutSession.line_items[0]?.price.currency_id;
44
46
  const defaultMethodId = paymentMethods.find((m) => m.payment_currencies.some((c) => c.id === defaultCurrencyId))?.id;
47
+ const hideSummaryCard = mode.endsWith("-minimal") || !showCheckoutSummary;
45
48
  const methods = useForm({
46
49
  defaultValues: {
47
50
  customer_name: customer?.name || session?.user?.fullName || "",
@@ -124,7 +127,7 @@ function PaymentInner({
124
127
  onPaid(result);
125
128
  };
126
129
  return /* @__PURE__ */ jsx(FormProvider, { ...methods, children: /* @__PURE__ */ jsxs(Stack, { className: "cko-container", sx: { gap: { sm: mode === "standalone" ? 0 : mode === "inline" ? 4 : 8 } }, children: [
127
- /* @__PURE__ */ jsx(Fade, { in: true, children: /* @__PURE__ */ jsxs(Stack, { className: "cko-overview base-card", direction: "column", children: [
130
+ !hideSummaryCard && /* @__PURE__ */ jsx(Fade, { in: true, children: /* @__PURE__ */ jsxs(Stack, { className: "base-card cko-overview", direction: "column", children: [
128
131
  /* @__PURE__ */ jsx(
129
132
  PaymentSummary,
130
133
  {
@@ -150,41 +153,53 @@ function PaymentInner({
150
153
  ),
151
154
  mode === "standalone" && !isMobile && /* @__PURE__ */ jsx(CheckoutFooter, { className: "cko-footer", sx: { color: "var(--foregrounds-fg-muted, #98A3B1)" } })
152
155
  ] }) }),
153
- /* @__PURE__ */ jsxs(Stack, { className: "cko-payment base-card", direction: "column", spacing: { xs: 2, sm: 3 }, children: [
154
- completed && /* @__PURE__ */ jsx(
155
- PaymentSuccess,
156
- {
157
- mode,
158
- payee: getStatementDescriptor(state.checkoutSession.line_items),
159
- action: state.checkoutSession.mode,
160
- invoiceId: state.checkoutSession.invoice_id,
161
- subscriptionId: state.checkoutSession.subscription_id,
162
- message: paymentLink?.after_completion?.hosted_confirmation?.custom_message || t(
163
- `payment.checkout.completed.${state.checkoutSession.submit_type === "donate" ? "donate" : state.checkoutSession.mode}`
156
+ /* @__PURE__ */ jsxs(
157
+ Stack,
158
+ {
159
+ className: "base-card cko-payment",
160
+ direction: "column",
161
+ spacing: {
162
+ xs: 2,
163
+ sm: 3
164
+ },
165
+ children: [
166
+ completed && /* @__PURE__ */ jsx(
167
+ PaymentSuccess,
168
+ {
169
+ mode,
170
+ payee: getStatementDescriptor(state.checkoutSession.line_items),
171
+ action: state.checkoutSession.mode,
172
+ invoiceId: state.checkoutSession.invoice_id,
173
+ subscriptionId: state.checkoutSession.subscription_id,
174
+ message: paymentLink?.after_completion?.hosted_confirmation?.custom_message || t(
175
+ `payment.checkout.completed.${state.checkoutSession.submit_type === "donate" ? "donate" : state.checkoutSession.mode}`
176
+ )
177
+ }
178
+ ),
179
+ !completed && /* @__PURE__ */ jsx(
180
+ PaymentForm,
181
+ {
182
+ checkoutSession: state.checkoutSession,
183
+ paymentMethods,
184
+ paymentIntent,
185
+ paymentLink,
186
+ customer,
187
+ onPaid: handlePaid,
188
+ onError,
189
+ mode,
190
+ action
191
+ }
164
192
  )
165
- }
166
- ),
167
- !completed && /* @__PURE__ */ jsx(
168
- PaymentForm,
169
- {
170
- checkoutSession: state.checkoutSession,
171
- paymentMethods,
172
- paymentIntent,
173
- paymentLink,
174
- customer,
175
- onPaid: handlePaid,
176
- onError,
177
- mode,
178
- action
179
- }
180
- )
181
- ] }),
193
+ ]
194
+ }
195
+ ),
182
196
  mode === "standalone" && isMobile && /* @__PURE__ */ jsx(CheckoutFooter, { className: "cko-footer", sx: { color: "var(--foregrounds-fg-muted, #98A3B1)" } })
183
197
  ] }) });
184
198
  }
185
199
  Payment.defaultProps = {
186
200
  completed: false,
187
- error: null
201
+ error: null,
202
+ showCheckoutSummary: true
188
203
  };
189
204
  export default function Payment({
190
205
  checkoutSession,
@@ -199,11 +214,13 @@ export default function Payment({
199
214
  onError,
200
215
  onChange,
201
216
  goBack,
202
- action
217
+ action,
218
+ showCheckoutSummary = true
203
219
  }) {
204
220
  const { t } = useLocaleContext();
205
221
  const { refresh, livemode, setLivemode } = usePaymentContext();
206
222
  const [delay, setDelay] = useState(false);
223
+ const hideSummaryCard = mode.endsWith("-minimal") || !showCheckoutSummary;
207
224
  useEffect(() => {
208
225
  setTimeout(() => {
209
226
  setDelay(true);
@@ -222,8 +239,8 @@ export default function Payment({
222
239
  const renderContent = () => {
223
240
  if (!checkoutSession || !delay) {
224
241
  return /* @__PURE__ */ jsxs(Stack, { className: "cko-container", sx: { gap: { sm: mode === "standalone" ? 0 : mode === "inline" ? 4 : 8 } }, children: [
225
- /* @__PURE__ */ jsx(Stack, { className: "cko-overview base-card", children: /* @__PURE__ */ jsx(Box, { className: "cko-product", children: /* @__PURE__ */ jsx(OverviewSkeleton, {}) }) }),
226
- /* @__PURE__ */ jsx(Stack, { className: "cko-payment base-card", children: /* @__PURE__ */ jsx(PaymentSkeleton, {}) })
242
+ !hideSummaryCard && /* @__PURE__ */ jsx(Stack, { className: "base-card cko-overview", children: /* @__PURE__ */ jsx(Box, { className: "cko-product", children: /* @__PURE__ */ jsx(OverviewSkeleton, {}) }) }),
243
+ /* @__PURE__ */ jsx(Stack, { className: "base-card cko-payment", children: /* @__PURE__ */ jsx(PaymentSkeleton, {}) })
227
244
  ] });
228
245
  }
229
246
  if (checkoutSession.expires_at <= Math.round(Date.now() / 1e3)) {
@@ -260,7 +277,8 @@ export default function Payment({
260
277
  onChange,
261
278
  goBack,
262
279
  mode,
263
- action
280
+ action,
281
+ showCheckoutSummary
264
282
  }
265
283
  );
266
284
  };
@@ -322,16 +340,24 @@ export const Root = styled(Box)`
322
340
  // padding: ${(props) => props.mode === "standalone" ? "0 16px" : "0"};
323
341
  }
324
342
 
343
+ .base-card {
344
+ border: none;
345
+ border-radius: 0;
346
+ padding: ${(props) => props.mode === "standalone" ? "100px 40px 20px" : "20px 0"};
347
+ box-shadow: none;
348
+ flex: 1;
349
+ max-width: 582px;
350
+ }
351
+
325
352
  .cko-overview {
326
353
  // width: ${(props) => props.mode.endsWith("-minimal") ? "100%" : "400px"};
327
354
  // min-height: ${(props) => props.mode === "standalone" ? "540px" : "auto"};
328
355
  position: relative;
329
- display: ${(props) => props.mode.endsWith("-minimal") ? "none" : "block"};
356
+ flex-direction: column;
357
+ display: ${(props) => props.mode.endsWith("-minimal") ? "none" : "flex"};
330
358
  background: var(--backgrounds-bg-base);
331
359
  min-height: 'auto';
332
360
  // width: 502px;
333
- display: flex;
334
- flex-direction: column;
335
361
  }
336
362
  .cko-header {
337
363
  left: 0;
@@ -357,15 +383,6 @@ export const Root = styled(Box)`
357
383
  text-overflow: ellipsis;
358
384
  }
359
385
 
360
- .base-card {
361
- border: none;
362
- border-radius: 0;
363
- padding: ${(props) => props.mode === "standalone" ? "100px 40px 20px" : "20px 0"};
364
- box-shadow: none;
365
- flex: 1;
366
- max-width: 582px;
367
- }
368
-
369
386
  .cko-payment {
370
387
  width: 502px;
371
388
  // width: ${(props) => props.mode.endsWith("-minimal") ? "100%" : "400px"};
@@ -405,7 +422,7 @@ export const Root = styled(Box)`
405
422
  margin-bottom: 4px;
406
423
  }
407
424
  .MuiBox-root {
408
- margin: -1px 0 0 -1px;
425
+ margin: 0;
409
426
  }
410
427
 
411
428
  .MuiFormHelperText-root {
@@ -464,9 +481,8 @@ export const Root = styled(Box)`
464
481
  flex-direction: column;
465
482
  align-items: center;
466
483
  gap: 32px;
467
- min-width: 350px;
468
- max-width: 400px;
469
484
  overflow: visible;
485
+ min-width: 200px;
470
486
  }
471
487
  .cko-overview {
472
488
  width: 100%;
@@ -57,7 +57,8 @@ export default function ProductDonation({
57
57
  if (event.target.checked) {
58
58
  setState({ custom: true, input: state.selected, error: "" });
59
59
  } else {
60
- setState({ custom: false, input: "", error: "" });
60
+ setPayable(true);
61
+ handleSelect(preset);
61
62
  }
62
63
  };
63
64
  return /* @__PURE__ */ jsxs(Box, { display: "flex", flexDirection: "column", alignItems: "flex-start", gap: 1.5, children: [
@@ -78,20 +79,30 @@ export default function ProductDonation({
78
79
  textAlign: "center",
79
80
  ...state.selected === amount && !state.custom ? { borderColor: "primary.main" } : {}
80
81
  },
81
- 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: [
82
- /* @__PURE__ */ jsx(
83
- Typography,
84
- {
85
- component: "strong",
86
- lineHeight: 1,
87
- variant: "h5",
88
- sx: { fontVariantNumeric: "tabular-nums", fontWeight: 400 },
89
- children: amount
90
- }
91
- ),
92
- /* @__PURE__ */ jsx(Typography, { component: "small", lineHeight: 1, fontSize: 12, children: "ABT" }),
93
- " "
94
- ] }) })
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
+ ) })
95
106
  },
96
107
  amount
97
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
  {
@@ -1,9 +1,14 @@
1
- import { type ThemeOptions } from '@mui/material/styles';
2
1
  import React from 'react';
3
2
  import { typography } from './typography';
4
3
  import './index.css';
4
+ import { PaymentThemeOptions } from '../types';
5
5
  export { typography };
6
- export declare const themeOverrides: Partial<ThemeOptions>;
7
- export declare function PaymentThemeProvider({ children }: {
6
+ export declare function PaymentThemeProvider({ children, theme: customTheme, }: {
8
7
  children: React.ReactNode;
8
+ theme?: PaymentThemeOptions;
9
9
  }): JSX.Element;
10
+ export declare namespace PaymentThemeProvider {
11
+ var defaultProps: {
12
+ theme: {};
13
+ };
14
+ }