@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.
@@ -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>>;
@@ -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;
@@ -29,7 +29,8 @@ var _summary = _interopRequireDefault(require("./summary"));
29
29
  var _mobile = require("../hooks/mobile");
30
30
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
31
31
  PaymentInner.defaultProps = {
32
- completed: false
32
+ completed: false,
33
+ showCheckoutSummary: true
33
34
  };
34
35
  function PaymentInner({
35
36
  checkoutSession,
@@ -42,7 +43,8 @@ function PaymentInner({
42
43
  onPaid,
43
44
  onError,
44
45
  onChange,
45
- action
46
+ action,
47
+ showCheckoutSummary = true
46
48
  }) {
47
49
  const {
48
50
  t
@@ -59,6 +61,7 @@ function PaymentInner({
59
61
  });
60
62
  const defaultCurrencyId = state.checkoutSession.currency_id || state.checkoutSession.line_items[0]?.price.currency_id;
61
63
  const defaultMethodId = paymentMethods.find(m => m.payment_currencies.some(c => c.id === defaultCurrencyId))?.id;
64
+ const hideSummaryCard = mode.endsWith("-minimal") || !showCheckoutSummary;
62
65
  const methods = (0, _reactHookForm.useForm)({
63
66
  defaultValues: {
64
67
  customer_name: customer?.name || session?.user?.fullName || "",
@@ -183,10 +186,10 @@ function PaymentInner({
183
186
  sm: mode === "standalone" ? 0 : mode === "inline" ? 4 : 8
184
187
  }
185
188
  },
186
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Fade, {
189
+ children: [!hideSummaryCard && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Fade, {
187
190
  in: true,
188
191
  children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
189
- className: "cko-overview base-card",
192
+ className: "base-card cko-overview",
190
193
  direction: "column",
191
194
  children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_summary.default, {
192
195
  items: state.checkoutSession.line_items,
@@ -213,7 +216,7 @@ function PaymentInner({
213
216
  })]
214
217
  })
215
218
  }), /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
216
- className: "cko-payment base-card",
219
+ className: "base-card cko-payment",
217
220
  direction: "column",
218
221
  spacing: {
219
222
  xs: 2,
@@ -248,7 +251,8 @@ function PaymentInner({
248
251
  }
249
252
  Payment.defaultProps = {
250
253
  completed: false,
251
- error: null
254
+ error: null,
255
+ showCheckoutSummary: true
252
256
  };
253
257
  function Payment({
254
258
  checkoutSession,
@@ -263,7 +267,8 @@ function Payment({
263
267
  onError,
264
268
  onChange,
265
269
  goBack,
266
- action
270
+ action,
271
+ showCheckoutSummary = true
267
272
  }) {
268
273
  const {
269
274
  t
@@ -274,6 +279,7 @@ function Payment({
274
279
  setLivemode
275
280
  } = (0, _payment.usePaymentContext)();
276
281
  const [delay, setDelay] = (0, _react.useState)(false);
282
+ const hideSummaryCard = mode.endsWith("-minimal") || !showCheckoutSummary;
277
283
  (0, _react.useEffect)(() => {
278
284
  setTimeout(() => {
279
285
  setDelay(true);
@@ -298,14 +304,14 @@ function Payment({
298
304
  sm: mode === "standalone" ? 0 : mode === "inline" ? 4 : 8
299
305
  }
300
306
  },
301
- children: [/* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
302
- className: "cko-overview base-card",
307
+ children: [!hideSummaryCard && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
308
+ className: "base-card cko-overview",
303
309
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Box, {
304
310
  className: "cko-product",
305
311
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_overview.default, {})
306
312
  })
307
313
  }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Stack, {
308
- className: "cko-payment base-card",
314
+ className: "base-card cko-payment",
309
315
  children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_payment2.default, {})
310
316
  })]
311
317
  });
@@ -336,7 +342,8 @@ function Payment({
336
342
  onChange,
337
343
  goBack,
338
344
  mode,
339
- action
345
+ action,
346
+ showCheckoutSummary
340
347
  });
341
348
  };
342
349
  return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Stack, {
@@ -407,16 +414,24 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
407
414
  // padding: ${props => props.mode === "standalone" ? "0 16px" : "0"};
408
415
  }
409
416
 
417
+ .base-card {
418
+ border: none;
419
+ border-radius: 0;
420
+ padding: ${props => props.mode === "standalone" ? "100px 40px 20px" : "20px 0"};
421
+ box-shadow: none;
422
+ flex: 1;
423
+ max-width: 582px;
424
+ }
425
+
410
426
  .cko-overview {
411
427
  // width: ${props => props.mode.endsWith("-minimal") ? "100%" : "400px"};
412
428
  // min-height: ${props => props.mode === "standalone" ? "540px" : "auto"};
413
429
  position: relative;
414
- display: ${props => props.mode.endsWith("-minimal") ? "none" : "block"};
430
+ flex-direction: column;
431
+ display: ${props => props.mode.endsWith("-minimal") ? "none" : "flex"};
415
432
  background: var(--backgrounds-bg-base);
416
433
  min-height: 'auto';
417
434
  // width: 502px;
418
- display: flex;
419
- flex-direction: column;
420
435
  }
421
436
  .cko-header {
422
437
  left: 0;
@@ -442,15 +457,6 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
442
457
  text-overflow: ellipsis;
443
458
  }
444
459
 
445
- .base-card {
446
- border: none;
447
- border-radius: 0;
448
- padding: ${props => props.mode === "standalone" ? "100px 40px 20px" : "20px 0"};
449
- box-shadow: none;
450
- flex: 1;
451
- max-width: 582px;
452
- }
453
-
454
460
  .cko-payment {
455
461
  width: 502px;
456
462
  // width: ${props => props.mode.endsWith("-minimal") ? "100%" : "400px"};
@@ -490,7 +496,7 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
490
496
  margin-bottom: 4px;
491
497
  }
492
498
  .MuiBox-root {
493
- margin: -1px 0 0 -1px;
499
+ margin: 0;
494
500
  }
495
501
 
496
502
  .MuiFormHelperText-root {
@@ -551,9 +557,8 @@ const Root = exports.Root = (0, _system.styled)(_material.Box)`
551
557
  flex-direction: column;
552
558
  align-items: center;
553
559
  gap: 32px;
554
- min-width: 350px;
555
- max-width: 400px;
556
560
  overflow: visible;
561
+ min-width: 200px;
557
562
  }
558
563
  .cko-overview {
559
564
  width: 100%;
@@ -109,11 +109,8 @@ function ProductDonation({
109
109
  error: ""
110
110
  });
111
111
  } else {
112
- setState({
113
- custom: false,
114
- input: "",
115
- error: ""
116
- });
112
+ setPayable(true);
113
+ handleSelect(preset);
117
114
  }
118
115
  };
119
116
  return /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Box, {
@@ -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
+ }