@blocklet/payment-react 1.18.56 → 1.19.0
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/checkout/donate.d.ts +1 -15
- package/es/checkout/donate.js +301 -189
- package/es/checkout/form.d.ts +1 -15
- package/es/checkout/form.js +5 -13
- package/es/checkout/table.js +3 -3
- package/es/components/blockchain/gas.d.ts +1 -5
- package/es/components/blockchain/gas.js +10 -2
- package/es/components/blockchain/tx.d.ts +1 -8
- package/es/components/blockchain/tx.js +28 -7
- package/es/components/confirm.d.ts +1 -10
- package/es/components/confirm.js +4 -10
- package/es/components/country-select.d.ts +3 -2
- package/es/components/country-select.js +375 -352
- package/es/components/input.d.ts +11 -20
- package/es/components/input.js +46 -43
- package/es/components/lazy-loader.js +1 -2
- package/es/components/link.d.ts +2 -9
- package/es/components/link.js +9 -6
- package/es/components/livemode.d.ts +2 -8
- package/es/components/livemode.js +1 -5
- package/es/components/loading-button.d.ts +6 -1
- package/es/components/loading-button.js +56 -66
- package/es/components/over-due-invoice-payment.d.ts +0 -18
- package/es/components/over-due-invoice-payment.js +138 -95
- package/es/components/payment-beneficiaries.d.ts +2 -7
- package/es/components/payment-beneficiaries.js +86 -40
- package/es/components/pricing-item.d.ts +0 -5
- package/es/components/pricing-item.js +1 -4
- package/es/components/pricing-table.d.ts +2 -10
- package/es/components/pricing-table.js +8 -7
- package/es/components/resume-subscription.d.ts +0 -10
- package/es/components/resume-subscription.js +42 -21
- package/es/components/truncated-text.d.ts +2 -9
- package/es/components/truncated-text.js +0 -5
- package/es/contexts/donate.d.ts +0 -7
- package/es/contexts/donate.js +10 -8
- package/es/contexts/payment.d.ts +1 -4
- package/es/contexts/payment.js +7 -2
- package/es/history/invoice/list.d.ts +2 -18
- package/es/history/invoice/list.js +151 -73
- package/es/history/payment/list.js +115 -38
- package/es/hooks/keyboard.d.ts +1 -1
- package/es/hooks/keyboard.js +2 -4
- package/es/libs/cached-request.js +2 -4
- package/es/libs/phone-validator.js +1 -2
- package/es/libs/util.js +2 -4
- package/es/libs/validator.js +2 -4
- package/es/payment/amount.d.ts +2 -7
- package/es/payment/amount.js +1 -5
- package/es/payment/donation-form.d.ts +2 -10
- package/es/payment/donation-form.js +196 -160
- package/es/payment/error.d.ts +2 -8
- package/es/payment/error.js +40 -20
- package/es/payment/footer.d.ts +2 -3
- package/es/payment/footer.js +19 -6
- package/es/payment/form/addon.js +14 -4
- package/es/payment/form/address.d.ts +2 -9
- package/es/payment/form/address.js +3 -6
- package/es/payment/form/currency.js +45 -25
- package/es/payment/form/index.d.ts +2 -8
- package/es/payment/form/index.js +107 -65
- package/es/payment/form/phone.js +2 -4
- package/es/payment/form/stripe/form.d.ts +2 -8
- package/es/payment/form/stripe/form.js +1 -3
- package/es/payment/header.js +38 -16
- package/es/payment/index.d.ts +2 -9
- package/es/payment/index.js +5 -14
- package/es/payment/product-card.d.ts +2 -11
- package/es/payment/product-card.js +84 -50
- package/es/payment/product-donation.js +175 -114
- package/es/payment/product-item.d.ts +2 -9
- package/es/payment/product-item.js +185 -142
- package/es/payment/product-skeleton.js +2 -2
- package/es/payment/skeleton/donation.js +27 -7
- package/es/payment/skeleton/overview.js +22 -2
- package/es/payment/skeleton/payment.js +33 -5
- package/es/payment/success.d.ts +2 -9
- package/es/payment/success.js +41 -14
- package/es/payment/summary.d.ts +2 -17
- package/es/payment/summary.js +184 -111
- package/es/theme/index.d.ts +0 -5
- package/es/theme/index.js +2 -5
- package/es/theme/typography.d.ts +2 -2
- package/lib/checkout/donate.d.ts +1 -15
- package/lib/checkout/donate.js +75 -54
- package/lib/checkout/form.d.ts +1 -15
- package/lib/checkout/form.js +7 -15
- package/lib/checkout/table.js +4 -4
- package/lib/components/blockchain/gas.d.ts +1 -5
- package/lib/components/blockchain/gas.js +3 -2
- package/lib/components/blockchain/tx.d.ts +1 -8
- package/lib/components/blockchain/tx.js +11 -7
- package/lib/components/confirm.d.ts +1 -10
- package/lib/components/confirm.js +5 -11
- package/lib/components/country-select.d.ts +3 -2
- package/lib/components/country-select.js +23 -22
- package/lib/components/input.d.ts +11 -20
- package/lib/components/input.js +20 -23
- package/lib/components/lazy-loader.js +1 -1
- package/lib/components/link.d.ts +2 -9
- package/lib/components/link.js +3 -8
- package/lib/components/livemode.d.ts +2 -8
- package/lib/components/livemode.js +3 -7
- package/lib/components/loading-button.d.ts +6 -1
- package/lib/components/loading-button.js +9 -17
- package/lib/components/over-due-invoice-payment.d.ts +0 -18
- package/lib/components/over-due-invoice-payment.js +31 -33
- package/lib/components/payment-beneficiaries.d.ts +2 -7
- package/lib/components/payment-beneficiaries.js +12 -11
- package/lib/components/pricing-item.d.ts +0 -5
- package/lib/components/pricing-item.js +2 -5
- package/lib/components/pricing-table.d.ts +2 -10
- package/lib/components/pricing-table.js +5 -11
- package/lib/components/resume-subscription.d.ts +0 -10
- package/lib/components/resume-subscription.js +16 -16
- package/lib/components/table.js +1 -1
- package/lib/components/truncated-text.d.ts +2 -9
- package/lib/components/truncated-text.js +1 -6
- package/lib/contexts/donate.d.ts +0 -7
- package/lib/contexts/donate.js +4 -7
- package/lib/contexts/payment.d.ts +1 -4
- package/lib/contexts/payment.js +4 -7
- package/lib/history/invoice/list.d.ts +2 -18
- package/lib/history/invoice/list.js +49 -37
- package/lib/history/payment/list.js +30 -16
- package/lib/hooks/keyboard.d.ts +1 -1
- package/lib/hooks/mobile.js +1 -1
- package/lib/hooks/subscription.js +1 -1
- package/lib/index.js +2 -2
- package/lib/libs/api.js +1 -1
- package/lib/libs/dayjs.js +1 -1
- package/lib/libs/phone-validator.js +0 -2
- package/lib/libs/theme.js +1 -1
- package/lib/libs/util.js +1 -1
- package/lib/libs/validator.js +1 -1
- package/lib/locales/en.js +1 -1
- package/lib/locales/index.js +1 -1
- package/lib/locales/zh.js +1 -1
- package/lib/payment/amount.d.ts +2 -7
- package/lib/payment/amount.js +2 -6
- package/lib/payment/donation-form.d.ts +2 -10
- package/lib/payment/donation-form.js +33 -38
- package/lib/payment/error.d.ts +2 -8
- package/lib/payment/error.js +11 -13
- package/lib/payment/footer.d.ts +2 -3
- package/lib/payment/footer.js +5 -5
- package/lib/payment/form/addon.js +5 -3
- package/lib/payment/form/address.d.ts +2 -9
- package/lib/payment/form/address.js +5 -8
- package/lib/payment/form/currency.js +3 -3
- package/lib/payment/form/index.d.ts +2 -8
- package/lib/payment/form/index.js +19 -15
- package/lib/payment/form/phone.js +1 -1
- package/lib/payment/form/stripe/form.d.ts +2 -8
- package/lib/payment/form/stripe/form.js +3 -6
- package/lib/payment/header.js +8 -4
- package/lib/payment/index.d.ts +2 -9
- package/lib/payment/index.js +7 -16
- package/lib/payment/product-card.d.ts +2 -11
- package/lib/payment/product-card.js +13 -20
- package/lib/payment/product-donation.js +71 -66
- package/lib/payment/product-item.d.ts +2 -9
- package/lib/payment/product-item.js +24 -25
- package/lib/payment/product-skeleton.js +2 -2
- package/lib/payment/skeleton/donation.js +8 -4
- package/lib/payment/skeleton/overview.js +6 -2
- package/lib/payment/skeleton/payment.js +9 -3
- package/lib/payment/success.d.ts +2 -9
- package/lib/payment/success.js +12 -15
- package/lib/payment/summary.d.ts +2 -17
- package/lib/payment/summary.js +44 -45
- package/lib/theme/index.d.ts +0 -5
- package/lib/theme/index.js +2 -5
- package/lib/theme/typography.d.ts +2 -2
- package/package.json +40 -40
- package/src/checkout/donate.tsx +103 -35
- package/src/checkout/form.tsx +5 -14
- package/src/checkout/table.tsx +3 -3
- package/src/components/blockchain/gas.tsx +5 -3
- package/src/components/blockchain/tx.tsx +22 -8
- package/src/components/confirm.tsx +4 -11
- package/src/components/country-select.tsx +391 -378
- package/src/components/input.tsx +49 -45
- package/src/components/link.tsx +9 -7
- package/src/components/livemode.tsx +2 -6
- package/src/components/loading-button.tsx +63 -76
- package/src/components/over-due-invoice-payment.tsx +43 -28
- package/src/components/payment-beneficiaries.tsx +33 -14
- package/src/components/pricing-item.tsx +1 -4
- package/src/components/pricing-table.tsx +8 -8
- package/src/components/resume-subscription.tsx +20 -14
- package/src/components/table.tsx +2 -2
- package/src/components/truncated-text.tsx +0 -6
- package/src/contexts/donate.tsx +6 -7
- package/src/contexts/payment.tsx +7 -3
- package/src/history/invoice/list.tsx +74 -35
- package/src/history/payment/list.tsx +53 -16
- package/src/hooks/keyboard.ts +1 -1
- package/src/payment/amount.tsx +1 -6
- package/src/payment/donation-form.tsx +47 -29
- package/src/payment/error.tsx +16 -8
- package/src/payment/footer.tsx +11 -3
- package/src/payment/form/addon.tsx +6 -1
- package/src/payment/form/address.tsx +3 -7
- package/src/payment/form/currency.tsx +12 -2
- package/src/payment/form/index.tsx +30 -12
- package/src/payment/form/stripe/form.tsx +1 -5
- package/src/payment/header.tsx +14 -2
- package/src/payment/index.tsx +10 -21
- package/src/payment/product-card.tsx +41 -18
- package/src/payment/product-donation.tsx +85 -47
- package/src/payment/product-item.tsx +46 -24
- package/src/payment/product-skeleton.tsx +3 -2
- package/src/payment/skeleton/donation.tsx +12 -2
- package/src/payment/skeleton/overview.tsx +12 -2
- package/src/payment/skeleton/payment.tsx +16 -3
- package/src/payment/success.tsx +26 -15
- package/src/payment/summary.tsx +74 -42
- package/src/theme/index.tsx +5 -8
- package/src/theme/typography.ts +2 -2
|
@@ -149,11 +149,6 @@ const setUserFormValues = (
|
|
|
149
149
|
});
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
-
PaymentForm.defaultProps = {
|
|
153
|
-
onlyShowBtn: false,
|
|
154
|
-
isDonation: false,
|
|
155
|
-
};
|
|
156
|
-
|
|
157
152
|
// FIXME: https://stripe.com/docs/elements/address-element
|
|
158
153
|
// TODO: https://country-regions.github.io/react-country-region-selector/
|
|
159
154
|
// https://www.npmjs.com/package/postal-codes-js
|
|
@@ -169,7 +164,7 @@ export default function PaymentForm({
|
|
|
169
164
|
onError,
|
|
170
165
|
// mode,
|
|
171
166
|
action,
|
|
172
|
-
onlyShowBtn,
|
|
167
|
+
onlyShowBtn = false,
|
|
173
168
|
isDonation = false,
|
|
174
169
|
}: PageData) {
|
|
175
170
|
// const theme = useTheme();
|
|
@@ -596,8 +591,17 @@ export default function PaymentForm({
|
|
|
596
591
|
<Typography>{t('payment.checkout.fastPay.autoPaymentReason')}</Typography>
|
|
597
592
|
<Divider sx={{ mt: 1.5, mb: 1.5 }} />
|
|
598
593
|
<Stack spacing={1}>
|
|
599
|
-
<Stack
|
|
600
|
-
|
|
594
|
+
<Stack
|
|
595
|
+
sx={{
|
|
596
|
+
flexDirection: 'row',
|
|
597
|
+
alignItems: 'center',
|
|
598
|
+
justifyContent: 'space-between',
|
|
599
|
+
}}>
|
|
600
|
+
<Typography
|
|
601
|
+
sx={{
|
|
602
|
+
color: 'text.primary',
|
|
603
|
+
whiteSpace: 'nowrap',
|
|
604
|
+
}}>
|
|
601
605
|
{t('payment.checkout.fastPay.payer')}
|
|
602
606
|
</Typography>
|
|
603
607
|
<Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}>
|
|
@@ -619,8 +623,18 @@ export default function PaymentForm({
|
|
|
619
623
|
)}
|
|
620
624
|
</Box>
|
|
621
625
|
</Stack>
|
|
622
|
-
<Stack
|
|
623
|
-
|
|
626
|
+
<Stack
|
|
627
|
+
sx={{
|
|
628
|
+
flexDirection: 'row',
|
|
629
|
+
alignItems: 'center',
|
|
630
|
+
justifyContent: 'space-between',
|
|
631
|
+
}}>
|
|
632
|
+
<Typography
|
|
633
|
+
sx={{
|
|
634
|
+
color: 'text.primary',
|
|
635
|
+
}}>
|
|
636
|
+
{t('payment.checkout.fastPay.amount')}
|
|
637
|
+
</Typography>
|
|
624
638
|
<Typography>
|
|
625
639
|
{fromUnitToToken(state.fastCheckoutInfo.amount, paymentCurrency?.decimal || 18).toString()}{' '}
|
|
626
640
|
{paymentCurrency?.symbol}
|
|
@@ -708,7 +722,12 @@ export default function PaymentForm({
|
|
|
708
722
|
{t('payment.checkout.paymentDetails')}
|
|
709
723
|
</Typography>
|
|
710
724
|
<Fade in>
|
|
711
|
-
<Stack
|
|
725
|
+
<Stack
|
|
726
|
+
direction="column"
|
|
727
|
+
className="cko-payment-methods"
|
|
728
|
+
sx={{
|
|
729
|
+
alignItems: 'flex-start',
|
|
730
|
+
}}>
|
|
712
731
|
<Stack direction="row" sx={{ width: '100%' }}>
|
|
713
732
|
<Controller
|
|
714
733
|
name="payment_currency"
|
|
@@ -808,7 +827,6 @@ export default function PaymentForm({
|
|
|
808
827
|
</Stack>
|
|
809
828
|
</Fade>
|
|
810
829
|
<Divider sx={{ mt: 2.5, mb: 2.5 }} />
|
|
811
|
-
|
|
812
830
|
<Fade in>
|
|
813
831
|
<Stack className="cko-payment-submit">
|
|
814
832
|
<Box className="cko-payment-submit-btn">
|
|
@@ -19,7 +19,7 @@ export type StripeCheckoutFormProps = {
|
|
|
19
19
|
customer: TCustomer;
|
|
20
20
|
mode: string;
|
|
21
21
|
onConfirm: Function;
|
|
22
|
-
returnUrl
|
|
22
|
+
returnUrl?: string;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
const PaymentElementContainer = styled('div')`
|
|
@@ -349,7 +349,3 @@ export default function StripeCheckout({
|
|
|
349
349
|
</Dialog>
|
|
350
350
|
);
|
|
351
351
|
}
|
|
352
|
-
|
|
353
|
-
StripeCheckout.defaultProps = {
|
|
354
|
-
returnUrl: '',
|
|
355
|
-
};
|
package/src/payment/header.tsx
CHANGED
|
@@ -28,8 +28,20 @@ export default function PaymentHeader({ checkoutSession }: Props) {
|
|
|
28
28
|
}, [domSize, theme]);
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
|
-
<Stack
|
|
32
|
-
|
|
31
|
+
<Stack
|
|
32
|
+
className="cko-header"
|
|
33
|
+
direction="row"
|
|
34
|
+
spacing={1}
|
|
35
|
+
sx={{
|
|
36
|
+
alignItems: 'center',
|
|
37
|
+
justifyContent: 'space-between',
|
|
38
|
+
}}>
|
|
39
|
+
<Stack
|
|
40
|
+
direction="row"
|
|
41
|
+
spacing={1}
|
|
42
|
+
sx={{
|
|
43
|
+
alignItems: 'center',
|
|
44
|
+
}}>
|
|
33
45
|
<Avatar
|
|
34
46
|
variant="square"
|
|
35
47
|
src={window.blocklet.appLogo}
|
package/src/payment/index.tsx
CHANGED
|
@@ -47,18 +47,13 @@ import { getCurrencyPreference } from '../libs/currency';
|
|
|
47
47
|
// eslint-disable-next-line react/no-unused-prop-types
|
|
48
48
|
type Props = CheckoutContext & CheckoutCallbacks & { completed?: boolean; error?: any; showCheckoutSummary?: boolean };
|
|
49
49
|
|
|
50
|
-
PaymentInner.defaultProps = {
|
|
51
|
-
completed: false,
|
|
52
|
-
showCheckoutSummary: true,
|
|
53
|
-
};
|
|
54
|
-
|
|
55
50
|
function PaymentInner({
|
|
56
51
|
checkoutSession,
|
|
57
52
|
paymentMethods,
|
|
58
53
|
paymentLink,
|
|
59
54
|
paymentIntent,
|
|
60
55
|
customer,
|
|
61
|
-
completed,
|
|
56
|
+
completed = false,
|
|
62
57
|
mode,
|
|
63
58
|
onPaid,
|
|
64
59
|
onError,
|
|
@@ -332,20 +327,14 @@ function PaymentInner({
|
|
|
332
327
|
);
|
|
333
328
|
}
|
|
334
329
|
|
|
335
|
-
Payment.defaultProps = {
|
|
336
|
-
completed: false,
|
|
337
|
-
error: null,
|
|
338
|
-
showCheckoutSummary: true,
|
|
339
|
-
};
|
|
340
|
-
|
|
341
330
|
export default function Payment({
|
|
342
331
|
checkoutSession,
|
|
343
332
|
paymentMethods,
|
|
344
333
|
paymentIntent,
|
|
345
334
|
paymentLink,
|
|
346
335
|
customer,
|
|
347
|
-
completed,
|
|
348
|
-
error,
|
|
336
|
+
completed = false,
|
|
337
|
+
error = null,
|
|
349
338
|
mode,
|
|
350
339
|
onPaid,
|
|
351
340
|
onError,
|
|
@@ -435,9 +424,9 @@ export default function Payment({
|
|
|
435
424
|
|
|
436
425
|
return (
|
|
437
426
|
<Stack
|
|
438
|
-
display="flex"
|
|
439
|
-
flexDirection="column"
|
|
440
427
|
sx={{
|
|
428
|
+
display: 'flex',
|
|
429
|
+
flexDirection: 'column',
|
|
441
430
|
height: mode === 'standalone' ? '100vh' : 'auto',
|
|
442
431
|
overflow: isMobileSafariEnv ? 'visible' : 'hidden',
|
|
443
432
|
}}>
|
|
@@ -630,21 +619,21 @@ export const Root: React.FC<RootProps> = styled(Box)<RootProps>`
|
|
|
630
619
|
}
|
|
631
620
|
|
|
632
621
|
.product-item {
|
|
633
|
-
border-radius: ${({ theme }) => `${2 * theme.shape.borderRadius}px`};
|
|
622
|
+
border-radius: ${({ theme }) => `${2 * (theme.shape.borderRadius as number)}px`};
|
|
634
623
|
border: 1px solid;
|
|
635
624
|
border-color: ${({ theme }) => theme.palette.grey[100]};
|
|
636
625
|
.product-item-content {
|
|
637
626
|
padding: 16px;
|
|
638
627
|
background: ${({ theme }) => theme.palette.grey[50]};
|
|
639
|
-
border-top-left-radius: ${({ theme }) => `${2 * theme.shape.borderRadius}px`};
|
|
640
|
-
border-top-right-radius: ${({ theme }) => `${2 * theme.shape.borderRadius}px`};
|
|
628
|
+
border-top-left-radius: ${({ theme }) => `${2 * (theme.shape.borderRadius as number)}px`};
|
|
629
|
+
border-top-right-radius: ${({ theme }) => `${2 * (theme.shape.borderRadius as number)}px`};
|
|
641
630
|
}
|
|
642
631
|
.product-item-upsell {
|
|
643
632
|
margin-top: 0;
|
|
644
633
|
padding: 16px;
|
|
645
634
|
background: ${({ theme }) => theme.palette.grey[100]};
|
|
646
|
-
border-bottom-left-radius: ${({ theme }) => `${2 * theme.shape.borderRadius}px`};
|
|
647
|
-
border-bottom-right-radius: ${({ theme }) => `${2 * theme.shape.borderRadius}px`};
|
|
635
|
+
border-bottom-left-radius: ${({ theme }) => `${2 * (theme.shape.borderRadius as number)}px`};
|
|
636
|
+
border-bottom-right-radius: ${({ theme }) => `${2 * (theme.shape.borderRadius as number)}px`};
|
|
648
637
|
}
|
|
649
638
|
}
|
|
650
639
|
|
|
@@ -11,10 +11,24 @@ type Props = {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
// FIXME: @wangshijun add image filter for logo
|
|
14
|
-
export default function ProductCard({
|
|
14
|
+
export default function ProductCard({
|
|
15
|
+
size = 48,
|
|
16
|
+
variant = 'rounded',
|
|
17
|
+
name,
|
|
18
|
+
logo = '',
|
|
19
|
+
description = '',
|
|
20
|
+
extra = undefined,
|
|
21
|
+
}: Props) {
|
|
15
22
|
const s = { width: size, height: size };
|
|
16
23
|
return (
|
|
17
|
-
<Stack
|
|
24
|
+
<Stack
|
|
25
|
+
direction="row"
|
|
26
|
+
spacing={1}
|
|
27
|
+
sx={{
|
|
28
|
+
alignItems: 'center',
|
|
29
|
+
flex: 2,
|
|
30
|
+
width: '100%',
|
|
31
|
+
}}>
|
|
18
32
|
{logo ? (
|
|
19
33
|
// @ts-ignore
|
|
20
34
|
<Avatar src={logo} alt={name} variant={variant} sx={s} />
|
|
@@ -26,28 +40,45 @@ export default function ProductCard({ size, variant, name, logo, description, ex
|
|
|
26
40
|
)}
|
|
27
41
|
<Stack
|
|
28
42
|
direction="column"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
43
|
+
sx={{
|
|
44
|
+
alignItems: 'flex-start',
|
|
45
|
+
justifyContent: 'space-around',
|
|
46
|
+
flexShrink: 1,
|
|
47
|
+
overflow: 'hidden',
|
|
48
|
+
}}>
|
|
32
49
|
<Typography
|
|
33
50
|
className="cko-ellipsis"
|
|
34
51
|
variant="body1"
|
|
35
52
|
title={name}
|
|
36
|
-
sx={{
|
|
37
|
-
|
|
53
|
+
sx={{
|
|
54
|
+
color: 'text.primary',
|
|
55
|
+
fontWeight: 500,
|
|
56
|
+
mb: 0.5,
|
|
57
|
+
lineHeight: 1.2,
|
|
58
|
+
fontSize: 16,
|
|
59
|
+
}}>
|
|
38
60
|
{name}
|
|
39
61
|
</Typography>
|
|
40
62
|
{description && (
|
|
41
63
|
<Typography
|
|
42
64
|
variant="body1"
|
|
43
65
|
title={description}
|
|
44
|
-
sx={{
|
|
45
|
-
|
|
66
|
+
sx={{
|
|
67
|
+
color: 'text.lighter',
|
|
68
|
+
fontSize: '0.74375rem',
|
|
69
|
+
mb: 0.5,
|
|
70
|
+
lineHeight: 1.2,
|
|
71
|
+
textAlign: 'left',
|
|
72
|
+
}}>
|
|
46
73
|
{description}
|
|
47
74
|
</Typography>
|
|
48
75
|
)}
|
|
49
76
|
{extra && (
|
|
50
|
-
<Box
|
|
77
|
+
<Box
|
|
78
|
+
sx={{
|
|
79
|
+
color: 'text.lighter',
|
|
80
|
+
fontSize: '0.74375rem',
|
|
81
|
+
}}>
|
|
51
82
|
{extra}
|
|
52
83
|
</Box>
|
|
53
84
|
)}
|
|
@@ -55,11 +86,3 @@ export default function ProductCard({ size, variant, name, logo, description, ex
|
|
|
55
86
|
</Stack>
|
|
56
87
|
);
|
|
57
88
|
}
|
|
58
|
-
|
|
59
|
-
ProductCard.defaultProps = {
|
|
60
|
-
logo: '',
|
|
61
|
-
size: 48,
|
|
62
|
-
description: '',
|
|
63
|
-
variant: 'rounded',
|
|
64
|
-
extra: undefined,
|
|
65
|
-
};
|
|
@@ -265,17 +265,24 @@ export default function ProductDonation({
|
|
|
265
265
|
return (
|
|
266
266
|
<Box
|
|
267
267
|
ref={containerRef}
|
|
268
|
-
display="flex"
|
|
269
|
-
flexDirection="column"
|
|
270
|
-
alignItems="flex-start"
|
|
271
|
-
gap={1.5}
|
|
272
268
|
onKeyDown={handleKeyDown}
|
|
273
269
|
tabIndex={0}
|
|
274
|
-
sx={{
|
|
270
|
+
sx={{
|
|
271
|
+
display: 'flex',
|
|
272
|
+
flexDirection: 'column',
|
|
273
|
+
alignItems: 'flex-start',
|
|
274
|
+
gap: 1.5,
|
|
275
|
+
outline: 'none',
|
|
276
|
+
}}>
|
|
275
277
|
{supportPreset && (
|
|
276
278
|
<Grid container spacing={2}>
|
|
277
279
|
{presets.map((amount) => (
|
|
278
|
-
<Grid
|
|
280
|
+
<Grid
|
|
281
|
+
size={{
|
|
282
|
+
xs: 6,
|
|
283
|
+
sm: 3,
|
|
284
|
+
}}
|
|
285
|
+
key={amount}>
|
|
279
286
|
<Card
|
|
280
287
|
variant="outlined"
|
|
281
288
|
className="tab-navigable-card"
|
|
@@ -302,19 +309,30 @@ export default function ProductDonation({
|
|
|
302
309
|
aria-selected={formatAmount(state.selected) === formatAmount(amount) && !state.custom}>
|
|
303
310
|
<Stack
|
|
304
311
|
direction="row"
|
|
305
|
-
sx={{ py: 1.5, px: 1.5 }}
|
|
306
312
|
spacing={0.5}
|
|
307
|
-
|
|
308
|
-
|
|
313
|
+
sx={{
|
|
314
|
+
alignItems: 'center',
|
|
315
|
+
justifyContent: 'center',
|
|
316
|
+
py: 1.5,
|
|
317
|
+
px: 1.5,
|
|
318
|
+
}}>
|
|
309
319
|
<Avatar src={currency?.logo} sx={{ width: 16, height: 16, mr: 0.5 }} alt={currency?.symbol} />
|
|
310
320
|
<Typography
|
|
311
321
|
component="strong"
|
|
312
|
-
lineHeight={1}
|
|
313
322
|
variant="h3"
|
|
314
|
-
sx={{
|
|
323
|
+
sx={{
|
|
324
|
+
lineHeight: 1,
|
|
325
|
+
fontVariantNumeric: 'tabular-nums',
|
|
326
|
+
fontWeight: 400,
|
|
327
|
+
}}>
|
|
315
328
|
{amount}
|
|
316
329
|
</Typography>
|
|
317
|
-
<Typography
|
|
330
|
+
<Typography
|
|
331
|
+
sx={{
|
|
332
|
+
lineHeight: 1,
|
|
333
|
+
fontSize: 14,
|
|
334
|
+
color: 'text.secondary',
|
|
335
|
+
}}>
|
|
318
336
|
{currency?.symbol}
|
|
319
337
|
</Typography>
|
|
320
338
|
</Stack>
|
|
@@ -323,7 +341,12 @@ export default function ProductDonation({
|
|
|
323
341
|
</Grid>
|
|
324
342
|
))}
|
|
325
343
|
{supportCustom && (
|
|
326
|
-
<Grid
|
|
344
|
+
<Grid
|
|
345
|
+
size={{
|
|
346
|
+
xs: 6,
|
|
347
|
+
sm: 3,
|
|
348
|
+
}}
|
|
349
|
+
key="custom">
|
|
327
350
|
<Card
|
|
328
351
|
variant="outlined"
|
|
329
352
|
className="tab-navigable-card"
|
|
@@ -344,11 +367,19 @@ export default function ProductDonation({
|
|
|
344
367
|
<CardActionArea onClick={handleCustomSelect} tabIndex={0} aria-selected={state.custom}>
|
|
345
368
|
<Stack
|
|
346
369
|
direction="row"
|
|
347
|
-
sx={{ py: 1.5, px: 1.5 }}
|
|
348
370
|
spacing={0.5}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
371
|
+
sx={{
|
|
372
|
+
alignItems: 'center',
|
|
373
|
+
justifyContent: 'center',
|
|
374
|
+
py: 1.5,
|
|
375
|
+
px: 1.5,
|
|
376
|
+
}}>
|
|
377
|
+
<Typography
|
|
378
|
+
variant="h3"
|
|
379
|
+
sx={{
|
|
380
|
+
lineHeight: 1,
|
|
381
|
+
fontWeight: 400,
|
|
382
|
+
}}>
|
|
352
383
|
{t('common.custom')}
|
|
353
384
|
</Typography>
|
|
354
385
|
</Stack>
|
|
@@ -368,36 +399,6 @@ export default function ProductDonation({
|
|
|
368
399
|
error={!!state.error}
|
|
369
400
|
helperText={state.error}
|
|
370
401
|
inputRef={customInputRef}
|
|
371
|
-
InputProps={{
|
|
372
|
-
endAdornment: (
|
|
373
|
-
<Stack direction="row" spacing={0.5} alignItems="center" sx={{ ml: 1 }}>
|
|
374
|
-
<IconButton
|
|
375
|
-
size="small"
|
|
376
|
-
onClick={handleCustomSelect}
|
|
377
|
-
disabled={state.animating}
|
|
378
|
-
sx={{
|
|
379
|
-
mr: 0.5,
|
|
380
|
-
opacity: state.animating ? 0.5 : 1,
|
|
381
|
-
transition: 'all 0.2s ease',
|
|
382
|
-
'&:hover': {
|
|
383
|
-
transform: 'scale(1.2)',
|
|
384
|
-
transition: 'transform 0.3s ease',
|
|
385
|
-
},
|
|
386
|
-
}}
|
|
387
|
-
aria-label={t('common.random')}>
|
|
388
|
-
<AutoAwesomeIcon fontSize="small" />
|
|
389
|
-
</IconButton>
|
|
390
|
-
<Avatar src={currency?.logo} sx={{ width: 16, height: 16 }} alt={currency?.symbol} />
|
|
391
|
-
<Typography>{currency?.symbol}</Typography>
|
|
392
|
-
</Stack>
|
|
393
|
-
),
|
|
394
|
-
autoComplete: 'off',
|
|
395
|
-
sx: {
|
|
396
|
-
'& input': {
|
|
397
|
-
transition: 'all 0.25s ease',
|
|
398
|
-
},
|
|
399
|
-
},
|
|
400
|
-
}}
|
|
401
402
|
sx={{
|
|
402
403
|
mt: defaultPreset !== '0' ? 0 : 1,
|
|
403
404
|
'& .MuiInputBase-root': {
|
|
@@ -414,7 +415,44 @@ export default function ProductDonation({
|
|
|
414
415
|
WebkitAppearance: 'none',
|
|
415
416
|
margin: 0,
|
|
416
417
|
},
|
|
418
|
+
'& input': {
|
|
419
|
+
transition: 'all 0.25s ease',
|
|
420
|
+
},
|
|
421
|
+
}}
|
|
422
|
+
slotProps={{
|
|
423
|
+
input: {
|
|
424
|
+
endAdornment: (
|
|
425
|
+
<Stack
|
|
426
|
+
direction="row"
|
|
427
|
+
spacing={0.5}
|
|
428
|
+
sx={{
|
|
429
|
+
alignItems: 'center',
|
|
430
|
+
ml: 1,
|
|
431
|
+
}}>
|
|
432
|
+
<IconButton
|
|
433
|
+
size="small"
|
|
434
|
+
onClick={handleCustomSelect}
|
|
435
|
+
disabled={state.animating}
|
|
436
|
+
sx={{
|
|
437
|
+
mr: 0.5,
|
|
438
|
+
opacity: state.animating ? 0.5 : 1,
|
|
439
|
+
transition: 'all 0.2s ease',
|
|
440
|
+
'&:hover': {
|
|
441
|
+
transform: 'scale(1.2)',
|
|
442
|
+
transition: 'transform 0.3s ease',
|
|
443
|
+
},
|
|
444
|
+
}}
|
|
445
|
+
aria-label={t('common.random')}>
|
|
446
|
+
<AutoAwesomeIcon fontSize="small" />
|
|
447
|
+
</IconButton>
|
|
448
|
+
<Avatar src={currency?.logo} sx={{ width: 16, height: 16 }} alt={currency?.symbol} />
|
|
449
|
+
<Typography>{currency?.symbol}</Typography>
|
|
450
|
+
</Stack>
|
|
451
|
+
),
|
|
452
|
+
autoComplete: 'off',
|
|
453
|
+
},
|
|
417
454
|
}}
|
|
455
|
+
autoComplete="off"
|
|
418
456
|
/>
|
|
419
457
|
)}
|
|
420
458
|
</Box>
|
|
@@ -27,20 +27,14 @@ type Props = {
|
|
|
27
27
|
children?: React.ReactNode;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
ProductItem.defaultProps = {
|
|
31
|
-
mode: 'normal',
|
|
32
|
-
children: null,
|
|
33
|
-
trialEnd: 0,
|
|
34
|
-
};
|
|
35
|
-
|
|
36
30
|
export default function ProductItem({
|
|
37
31
|
item,
|
|
38
32
|
items,
|
|
39
33
|
trialInDays,
|
|
40
34
|
trialEnd = 0,
|
|
41
35
|
currency,
|
|
42
|
-
mode,
|
|
43
|
-
children,
|
|
36
|
+
mode = 'normal',
|
|
37
|
+
children = null,
|
|
44
38
|
onUpsell,
|
|
45
39
|
onDownsell,
|
|
46
40
|
}: Props) {
|
|
@@ -60,28 +54,52 @@ export default function ProductItem({
|
|
|
60
54
|
}, [trialInDays, trialEnd, pricing, item, locale]);
|
|
61
55
|
|
|
62
56
|
return (
|
|
63
|
-
<Stack
|
|
64
|
-
|
|
57
|
+
<Stack
|
|
58
|
+
direction="column"
|
|
59
|
+
spacing={1}
|
|
60
|
+
className="product-item"
|
|
61
|
+
sx={{
|
|
62
|
+
alignItems: 'flex-start',
|
|
63
|
+
width: '100%',
|
|
64
|
+
}}>
|
|
65
|
+
<Stack
|
|
66
|
+
direction="column"
|
|
67
|
+
className="product-item-content"
|
|
68
|
+
sx={{
|
|
69
|
+
alignItems: 'flex-start',
|
|
70
|
+
width: '100%',
|
|
71
|
+
}}>
|
|
65
72
|
<Stack
|
|
66
73
|
direction="row"
|
|
67
|
-
alignItems="center"
|
|
68
|
-
flexWrap="wrap"
|
|
69
74
|
spacing={0.5}
|
|
70
|
-
|
|
71
|
-
|
|
75
|
+
sx={{
|
|
76
|
+
alignItems: 'center',
|
|
77
|
+
flexWrap: 'wrap',
|
|
78
|
+
justifyContent: 'space-between',
|
|
79
|
+
width: '100%',
|
|
80
|
+
}}>
|
|
72
81
|
<ProductCard
|
|
73
82
|
logo={item.price.product?.images[0]}
|
|
74
83
|
name={item.price.product?.name}
|
|
75
84
|
// description={item.price.product?.description}
|
|
76
85
|
extra={
|
|
77
|
-
<Box
|
|
86
|
+
<Box
|
|
87
|
+
sx={{
|
|
88
|
+
display: 'flex',
|
|
89
|
+
alignItems: 'center',
|
|
90
|
+
}}>
|
|
78
91
|
{item.price.type === 'recurring' && item.price.recurring
|
|
79
92
|
? [pricing.quantity, t('common.billed', { rule: `${formatRecurring(item.upsell_price?.recurring || item.price.recurring, true, 'per', locale)} ${metered}` })].filter(Boolean).join(', ') // prettier-ignore
|
|
80
93
|
: pricing.quantity}
|
|
81
94
|
</Box>
|
|
82
95
|
}
|
|
83
96
|
/>
|
|
84
|
-
<Stack
|
|
97
|
+
<Stack
|
|
98
|
+
direction="column"
|
|
99
|
+
sx={{
|
|
100
|
+
alignItems: 'flex-end',
|
|
101
|
+
flex: 1,
|
|
102
|
+
}}>
|
|
85
103
|
<Typography sx={{ color: 'text.primary', fontWeight: 500, whiteSpace: 'nowrap' }} gutterBottom>
|
|
86
104
|
{primaryText}
|
|
87
105
|
</Typography>
|
|
@@ -107,10 +125,12 @@ export default function ProductItem({
|
|
|
107
125
|
{canUpsell && !item.upsell_price_id && item.price.upsell?.upsells_to && (
|
|
108
126
|
<Stack
|
|
109
127
|
direction="row"
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
128
|
+
className="product-item-upsell"
|
|
129
|
+
sx={{
|
|
130
|
+
alignItems: 'center',
|
|
131
|
+
justifyContent: 'space-between',
|
|
132
|
+
width: '100%',
|
|
133
|
+
}}>
|
|
114
134
|
<Typography
|
|
115
135
|
component="label"
|
|
116
136
|
htmlFor="upsell-switch"
|
|
@@ -148,10 +168,12 @@ export default function ProductItem({
|
|
|
148
168
|
{canUpsell && item.upsell_price_id && (
|
|
149
169
|
<Stack
|
|
150
170
|
direction="row"
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
171
|
+
className="product-item-upsell"
|
|
172
|
+
sx={{
|
|
173
|
+
alignItems: 'center',
|
|
174
|
+
justifyContent: 'space-between',
|
|
175
|
+
width: '100%',
|
|
176
|
+
}}>
|
|
155
177
|
<Typography
|
|
156
178
|
component="label"
|
|
157
179
|
htmlFor="upsell-switch"
|
|
@@ -5,16 +5,17 @@ export default function ProductSkeleton({ count }: { count: number }) {
|
|
|
5
5
|
<Fade in>
|
|
6
6
|
<Stack
|
|
7
7
|
direction="column"
|
|
8
|
-
alignItems="center"
|
|
9
|
-
padding={4}
|
|
10
8
|
spacing={1}
|
|
11
9
|
sx={{
|
|
10
|
+
alignItems: 'center',
|
|
11
|
+
padding: 4,
|
|
12
12
|
width: 320,
|
|
13
13
|
border: '1px solid',
|
|
14
14
|
borderColor: 'grey.100',
|
|
15
15
|
borderRadius: 1,
|
|
16
16
|
transition: 'border-color 0.3s ease 0s, box-shadow 0.3s ease 0s',
|
|
17
17
|
boxShadow: '0 4px 8px rgba(0, 0, 0, 20%)',
|
|
18
|
+
|
|
18
19
|
'&:hover': {
|
|
19
20
|
borderColor: '#ddd',
|
|
20
21
|
boxShadow: '0 8px 16px rgba(0, 0, 0, 20%)',
|
|
@@ -18,9 +18,19 @@ export default function DonationSkeleton() {
|
|
|
18
18
|
},
|
|
19
19
|
}}
|
|
20
20
|
/>
|
|
21
|
-
<Stack
|
|
21
|
+
<Stack
|
|
22
|
+
direction="row"
|
|
23
|
+
spacing={2}
|
|
24
|
+
sx={{
|
|
25
|
+
justifyContent: 'space-between',
|
|
26
|
+
}}>
|
|
22
27
|
<Skeleton variant="text" sx={{ fontSize: '1.5rem', width: '40%' }} />
|
|
23
|
-
<Box
|
|
28
|
+
<Box
|
|
29
|
+
sx={{
|
|
30
|
+
display: 'flex',
|
|
31
|
+
alignItems: 'center',
|
|
32
|
+
gap: 2,
|
|
33
|
+
}}>
|
|
24
34
|
<Box>
|
|
25
35
|
<Skeleton height={60} width={80} />
|
|
26
36
|
</Box>
|
|
@@ -4,11 +4,21 @@ export default function OverviewSkeleton() {
|
|
|
4
4
|
return (
|
|
5
5
|
<Fade in>
|
|
6
6
|
<Stack direction="column">
|
|
7
|
-
<Stack
|
|
7
|
+
<Stack
|
|
8
|
+
direction="row"
|
|
9
|
+
spacing={2}
|
|
10
|
+
sx={{
|
|
11
|
+
alignItems: 'center',
|
|
12
|
+
}}>
|
|
8
13
|
<Skeleton variant="text" sx={{ fontSize: '1.75rem', width: '40%' }} />
|
|
9
14
|
</Stack>
|
|
10
15
|
<Skeleton sx={{ mt: 2 }} variant="rounded" height={100} />
|
|
11
|
-
<Typography
|
|
16
|
+
<Typography
|
|
17
|
+
component="div"
|
|
18
|
+
variant="h4"
|
|
19
|
+
sx={{
|
|
20
|
+
mt: 2,
|
|
21
|
+
}}>
|
|
12
22
|
<Skeleton />
|
|
13
23
|
</Typography>
|
|
14
24
|
<Typography component="div" variant="h2">
|