payment-kit 1.19.11 → 1.19.13

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.
Files changed (48) hide show
  1. package/api/src/libs/notification/template/one-time-payment-refund-succeeded.ts +274 -0
  2. package/api/src/libs/notification/template/one-time-payment-succeeded.ts +10 -21
  3. package/api/src/libs/notification/template/subscription-refund-succeeded.ts +23 -3
  4. package/api/src/libs/notification/template/subscription-will-renew.ts +15 -2
  5. package/api/src/libs/session.ts +70 -1
  6. package/api/src/locales/en.ts +10 -0
  7. package/api/src/locales/zh.ts +10 -0
  8. package/api/src/queues/credit-consume.ts +4 -1
  9. package/api/src/queues/notification.ts +16 -3
  10. package/api/src/routes/checkout-sessions.ts +9 -0
  11. package/blocklet.yml +6 -6
  12. package/package.json +16 -16
  13. package/screenshots/0ffe164ebe4aa2eb43f8d87f87683f7f.png +0 -0
  14. package/screenshots/1ef9e15ac36d4af5bef34941000ba3af.png +0 -0
  15. package/screenshots/3a4cab81c52c29662db8794b05ccc7c7.png +0 -0
  16. package/screenshots/77ac49b79ae920f0f253ce8c694ffd65.png +0 -0
  17. package/screenshots/7ea8ef758865ecf6edb712d3534d2974.png +0 -0
  18. package/src/components/chart.tsx +1 -1
  19. package/src/components/conditional-section.tsx +11 -1
  20. package/src/components/customer/credit-overview.tsx +51 -48
  21. package/src/components/drawer-form.tsx +1 -1
  22. package/src/components/filter-toolbar.tsx +1 -1
  23. package/src/components/info-card.tsx +1 -1
  24. package/src/components/invoice-pdf/pdf.tsx +1 -1
  25. package/src/components/layout/admin.tsx +0 -4
  26. package/src/components/metadata/form.tsx +1 -1
  27. package/src/components/meter/actions.tsx +1 -1
  28. package/src/components/meter/events-list.tsx +6 -0
  29. package/src/components/meter/usage-guide.tsx +1 -1
  30. package/src/components/payment-link/item.tsx +1 -1
  31. package/src/components/price/form.tsx +0 -19
  32. package/src/components/pricing-table/product-item.tsx +1 -1
  33. package/src/components/product/features.tsx +1 -1
  34. package/src/components/uploader.tsx +1 -1
  35. package/src/components/webhook/attempts.tsx +1 -1
  36. package/src/locales/en.tsx +7 -4
  37. package/src/locales/zh.tsx +6 -2
  38. package/src/pages/admin/developers/webhooks/detail.tsx +1 -1
  39. package/src/pages/admin/products/pricing-tables/create.tsx +2 -2
  40. package/src/pages/checkout/pricing-table.tsx +1 -1
  41. package/src/pages/customer/index.tsx +30 -14
  42. package/src/pages/customer/invoice/detail.tsx +1 -1
  43. package/src/pages/integrations/donations/preview.tsx +4 -4
  44. package/screenshots/checkout.png +0 -0
  45. package/screenshots/customer.png +0 -0
  46. package/screenshots/payment.png +0 -0
  47. package/screenshots/setting.png +0 -0
  48. package/screenshots/subscription_detail.png +0 -0
@@ -36,7 +36,7 @@ import type { SelectChangeEvent } from '@mui/material/Select';
36
36
  import { styled } from '@mui/system';
37
37
  import { useRequest, useSetState } from 'ahooks';
38
38
  import { flatten, isEmpty } from 'lodash';
39
- import { memo, useEffect, useState } from 'react';
39
+ import { memo, useEffect, useState, Fragment } from 'react';
40
40
  import { useNavigate, useSearchParams } from 'react-router-dom';
41
41
  import { joinURL } from 'ufo';
42
42
  import CreditOverview from '../../components/customer/credit-overview';
@@ -193,6 +193,10 @@ export default function CustomerHome() {
193
193
  const { t } = useLocaleContext();
194
194
  const { events } = useSessionContext();
195
195
  const { settings } = usePaymentContext();
196
+ const [domFilter, setDomFilter] = useSetState<any>({
197
+ credit: '',
198
+ revenue: '',
199
+ });
196
200
  const [subscriptionLoading, setSubscriptionLoading] = useState(false);
197
201
  const currencies = flatten(
198
202
  settings.paymentMethods?.map((method) =>
@@ -399,7 +403,7 @@ export default function CustomerHome() {
399
403
  p: 2,
400
404
  gap: 2,
401
405
  border: '1px solid',
402
- borderColor: 'grey.100',
406
+ borderColor: 'divider',
403
407
  boxShadow: 1,
404
408
  }}>
405
409
  <Stack
@@ -481,7 +485,7 @@ export default function CustomerHome() {
481
485
 
482
486
  // 独立的Credit Card组件
483
487
  const CreditCard = (
484
- <ConditionalSection skeleton={loadingCard}>
488
+ <ConditionalSection skeleton={loadingCard} onStateChange={(val) => setDomFilter({ credit: val })}>
485
489
  <Box className="base-card section section-credit">
486
490
  <Box className="section-header" sx={{ mb: 2 }}>
487
491
  <Typography variant="h3">{t('admin.creditGrants.title')}</Typography>
@@ -520,16 +524,28 @@ export default function CustomerHome() {
520
524
  );
521
525
 
522
526
  const RevenueCard = (
523
- <ConditionalSection skeleton={loadingCard}>
527
+ <ConditionalSection skeleton={loadingCard} onStateChange={(val) => setDomFilter({ revenue: val })}>
524
528
  <Box className="base-card section section-revenue">
525
529
  <Box className="section-header">
526
530
  <Typography variant="h3">{t('customer.payout.title')}</Typography>
527
531
  </Box>
528
- <CustomerRevenueList />
532
+ <Box className="section-body">
533
+ <CustomerRevenueList />
534
+ </Box>
529
535
  </Box>
530
536
  </ConditionalSection>
531
537
  );
532
538
 
539
+ const cards = [
540
+ { card: SummaryCard, key: 'summary' },
541
+ { card: CreditCard, key: 'credit' },
542
+ { card: SubscriptionCard, key: 'subscription' },
543
+ { card: InvoiceCard, key: 'invoice' },
544
+ { card: RevenueCard, key: 'revenue' },
545
+ ];
546
+
547
+ const visibleCards = cards.filter(({ card, key }) => card && domFilter[key] !== 'none');
548
+
533
549
  return (
534
550
  <Content>
535
551
  {data?.error && (
@@ -582,15 +598,12 @@ export default function CustomerHome() {
582
598
  />
583
599
  )}
584
600
  <Root>
585
- {SummaryCard}
586
- {SummaryCard && <Divider />}
587
- {CreditCard}
588
- {CreditCard && <Divider />}
589
- {SubscriptionCard}
590
- {SubscriptionCard && <Divider />}
591
- {InvoiceCard}
592
- {InvoiceCard && <Divider />}
593
- {RevenueCard}
601
+ {visibleCards.map(({ card, key }, index, array) => (
602
+ <Fragment key={key}>
603
+ {card}
604
+ {(domFilter[key] ? domFilter[key] === 'visible' : index < array.length - 1) && <Divider />}
605
+ </Fragment>
606
+ ))}
594
607
  </Root>
595
608
  </Content>
596
609
  );
@@ -627,6 +640,9 @@ const Root = styled(Stack)`
627
640
  gap: 24px;
628
641
  display: flex;
629
642
  flex-direction: column;
643
+ .section-body {
644
+ padding: 0 1px;
645
+ }
630
646
  @media (max-width: ${({ theme }) => theme.breakpoints.values.xl}px) {
631
647
  padding: 0px;
632
648
  .base-card {
@@ -170,7 +170,7 @@ export default function CustomerInvoiceDetail() {
170
170
  variant="outlined"
171
171
  color="primary"
172
172
  size="small"
173
- sx={{ borderColor: 'grey.100' }}
173
+ sx={{ borderColor: 'divider' }}
174
174
  disabled={state.paying}
175
175
  onClick={onPay}>
176
176
  {t('payment.customer.invoice.pay')}
@@ -25,7 +25,7 @@ function PreviewAvatars({ count }: { count: number }) {
25
25
  borderRadius: '50%',
26
26
  bgcolor: 'grey.200',
27
27
  border: '2px solid',
28
- borderColor: 'grey.100',
28
+ borderColor: 'divider',
29
29
  position: 'relative',
30
30
  marginLeft: i === 0 ? 0 : '-8px',
31
31
  zIndex: count - i,
@@ -151,7 +151,7 @@ export default function DonationPreview({ config }: { config: TSetting['settings
151
151
  borderRadius: '50%',
152
152
  bgcolor: 'grey.200',
153
153
  border: '2px solid',
154
- borderColor: 'grey.100',
154
+ borderColor: 'divider',
155
155
  position: 'relative',
156
156
  }}
157
157
  />
@@ -213,7 +213,7 @@ export default function DonationPreview({ config }: { config: TSetting['settings
213
213
  variant="outlined"
214
214
  size="small"
215
215
  sx={{
216
- borderColor: selectedAmount === amount ? 'primary.main' : 'grey.100',
216
+ borderColor: selectedAmount === amount ? 'primary.main' : 'divider',
217
217
  borderWidth: selectedAmount === amount ? 2 : 1,
218
218
  color: selectedAmount === amount ? 'primary.main' : 'text.primary',
219
219
  }}
@@ -226,7 +226,7 @@ export default function DonationPreview({ config }: { config: TSetting['settings
226
226
  variant="outlined"
227
227
  size="small"
228
228
  sx={{
229
- borderColor: showCustom ? 'primary.main' : 'grey.100',
229
+ borderColor: showCustom ? 'primary.main' : 'divider',
230
230
  borderWidth: showCustom ? 2 : 1,
231
231
  color: showCustom ? 'primary.main' : 'text.primary',
232
232
  }}
Binary file
Binary file
Binary file
Binary file
Binary file