payment-kit 1.13.112 → 1.13.114

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 (119) hide show
  1. package/api/src/libs/notification/template/subscription-trial-will-end.ts +1 -1
  2. package/api/src/libs/notification/template/subscription-will-renew.ts +1 -1
  3. package/blocklet.yml +1 -1
  4. package/package.json +6 -6
  5. package/src/components/actions.tsx +1 -2
  6. package/src/components/blockchain/tx.tsx +1 -1
  7. package/src/components/click-boundary.tsx +1 -2
  8. package/src/components/customer/actions.tsx +2 -3
  9. package/src/components/customer/edit.tsx +3 -3
  10. package/src/components/customer/form.tsx +22 -24
  11. package/src/components/drawer-form.tsx +2 -4
  12. package/src/components/event/list.tsx +2 -3
  13. package/src/components/invoice/action.tsx +2 -3
  14. package/src/components/invoice/list.tsx +3 -4
  15. package/src/components/invoice/table.tsx +7 -7
  16. package/src/components/metadata/form.tsx +3 -4
  17. package/src/components/passport/actions.tsx +1 -2
  18. package/src/components/passport/assign.tsx +1 -1
  19. package/src/components/payment-intent/actions.tsx +2 -3
  20. package/src/components/payment-intent/list.tsx +3 -4
  21. package/src/components/payment-link/actions.tsx +2 -3
  22. package/src/components/payment-link/item.tsx +3 -5
  23. package/src/components/payment-link/product-select.tsx +3 -4
  24. package/src/components/payment-link/rename.tsx +3 -4
  25. package/src/components/payment-method/arcblock.tsx +1 -2
  26. package/src/components/payment-method/bitcoin.tsx +1 -2
  27. package/src/components/payment-method/ethereum.tsx +1 -2
  28. package/src/components/payment-method/stripe.tsx +1 -2
  29. package/src/components/portal/invoice/list.tsx +4 -5
  30. package/src/components/portal/subscription/actions.tsx +7 -8
  31. package/src/components/portal/subscription/cancel.tsx +13 -12
  32. package/src/components/portal/subscription/list.tsx +4 -10
  33. package/src/components/price/currency-select.tsx +2 -2
  34. package/src/components/price/form.tsx +3 -4
  35. package/src/components/price/upsell-select.tsx +2 -3
  36. package/src/components/price/upsell.tsx +3 -5
  37. package/src/components/pricing-table/actions.tsx +2 -3
  38. package/src/components/pricing-table/payment-settings.tsx +4 -4
  39. package/src/components/pricing-table/price-item.tsx +4 -7
  40. package/src/components/pricing-table/product-item.tsx +3 -3
  41. package/src/components/pricing-table/rename.tsx +3 -4
  42. package/src/components/product/actions.tsx +2 -3
  43. package/src/components/product/add-price.tsx +2 -2
  44. package/src/components/product/create.tsx +2 -4
  45. package/src/components/product/cross-sell-select.tsx +3 -3
  46. package/src/components/product/cross-sell.tsx +4 -5
  47. package/src/components/product/edit.tsx +1 -1
  48. package/src/components/product/form.tsx +6 -6
  49. package/src/components/relative-time.tsx +1 -2
  50. package/src/components/subscription/actions/cancel.tsx +2 -3
  51. package/src/components/subscription/actions/index.tsx +2 -3
  52. package/src/components/subscription/items/actions.tsx +1 -1
  53. package/src/components/subscription/items/index.tsx +2 -2
  54. package/src/components/subscription/items/usage-records.tsx +2 -3
  55. package/src/components/subscription/list.tsx +3 -4
  56. package/src/components/subscription/metrics.tsx +2 -2
  57. package/src/components/subscription/status.tsx +3 -3
  58. package/src/components/webhook/attempts.tsx +3 -3
  59. package/src/contexts/products.tsx +2 -3
  60. package/src/libs/api.ts +2 -19
  61. package/src/libs/dayjs.ts +1 -15
  62. package/src/libs/util.ts +24 -555
  63. package/src/locales/en.tsx +0 -139
  64. package/src/locales/index.tsx +5 -23
  65. package/src/locales/zh.tsx +0 -136
  66. package/src/pages/admin/billing/invoices/detail.tsx +3 -4
  67. package/src/pages/admin/billing/subscriptions/detail.tsx +3 -3
  68. package/src/pages/admin/customers/customers/detail.tsx +3 -5
  69. package/src/pages/admin/customers/customers/index.tsx +2 -3
  70. package/src/pages/admin/developers/events/detail.tsx +2 -3
  71. package/src/pages/admin/developers/webhooks/detail.tsx +3 -4
  72. package/src/pages/admin/developers/webhooks/index.tsx +3 -4
  73. package/src/pages/admin/index.tsx +6 -5
  74. package/src/pages/admin/payments/intents/detail.tsx +4 -6
  75. package/src/pages/admin/payments/links/create.tsx +3 -5
  76. package/src/pages/admin/payments/links/detail.tsx +4 -5
  77. package/src/pages/admin/payments/links/index.tsx +4 -6
  78. package/src/pages/admin/products/passports/index.tsx +1 -1
  79. package/src/pages/admin/products/prices/actions.tsx +2 -3
  80. package/src/pages/admin/products/prices/detail.tsx +2 -3
  81. package/src/pages/admin/products/prices/list.tsx +2 -4
  82. package/src/pages/admin/products/pricing-tables/create.tsx +2 -3
  83. package/src/pages/admin/products/pricing-tables/detail.tsx +4 -5
  84. package/src/pages/admin/products/pricing-tables/index.tsx +2 -4
  85. package/src/pages/admin/products/products/create.tsx +2 -4
  86. package/src/pages/admin/products/products/detail.tsx +4 -5
  87. package/src/pages/admin/products/products/index.tsx +4 -6
  88. package/src/pages/admin/settings/payment-methods/create.tsx +3 -5
  89. package/src/pages/admin/settings/payment-methods/index.tsx +2 -3
  90. package/src/pages/checkout/index.tsx +6 -3
  91. package/src/pages/checkout/pay.tsx +3 -67
  92. package/src/pages/checkout/pricing-table.tsx +4 -128
  93. package/src/pages/customer/index.tsx +7 -7
  94. package/src/pages/customer/invoice.tsx +10 -11
  95. package/src/pages/customer/subscription/detail.tsx +4 -4
  96. package/src/pages/customer/subscription/update.tsx +19 -19
  97. package/src/components/checkout/amount.tsx +0 -24
  98. package/src/components/checkout/error.tsx +0 -30
  99. package/src/components/checkout/footer.tsx +0 -12
  100. package/src/components/checkout/form/address.tsx +0 -119
  101. package/src/components/checkout/form/index.tsx +0 -400
  102. package/src/components/checkout/form/phone.tsx +0 -103
  103. package/src/components/checkout/form/stripe.tsx +0 -195
  104. package/src/components/checkout/form/user-buttons.tsx +0 -24
  105. package/src/components/checkout/header.tsx +0 -40
  106. package/src/components/checkout/pay.tsx +0 -385
  107. package/src/components/checkout/pricing-table.tsx +0 -205
  108. package/src/components/checkout/product-card.tsx +0 -52
  109. package/src/components/checkout/product-item.tsx +0 -111
  110. package/src/components/checkout/skeleton/overview.tsx +0 -21
  111. package/src/components/checkout/skeleton/payment.tsx +0 -35
  112. package/src/components/checkout/success.tsx +0 -183
  113. package/src/components/checkout/summary.tsx +0 -198
  114. package/src/components/input.tsx +0 -58
  115. package/src/components/livemode.tsx +0 -23
  116. package/src/components/pricing-table/product-skeleton.tsx +0 -39
  117. package/src/components/status.tsx +0 -19
  118. package/src/components/switch.tsx +0 -48
  119. package/src/contexts/settings.tsx +0 -54
@@ -1,48 +0,0 @@
1
- import { Switch } from '@mui/material';
2
- import { styled } from '@mui/system';
3
- import type { LiteralUnion } from 'type-fest';
4
-
5
- type SwitchProps = {
6
- variant?: LiteralUnion<'success' | 'error' | 'warning' | 'info' | 'primary' | 'secondary', string>;
7
- };
8
-
9
- export default styled(Switch)<SwitchProps>(({ variant = 'success', theme }) => ({
10
- width: 28,
11
- height: 16,
12
- padding: 0,
13
- display: 'inline-flex',
14
- '&:active': {
15
- '& .MuiSwitch-thumb': {
16
- width: 15,
17
- },
18
- '& .MuiSwitch-switchBase.Mui-checked': {
19
- transform: 'translateX(9px)',
20
- },
21
- },
22
- '& .MuiSwitch-switchBase': {
23
- padding: 2,
24
- '&.Mui-checked': {
25
- transform: 'translateX(12px)',
26
- color: '#fff',
27
- '& + .MuiSwitch-track': {
28
- opacity: 1,
29
- backgroundColor: theme.palette[variant].light,
30
- },
31
- },
32
- },
33
- '& .MuiSwitch-thumb': {
34
- boxShadow: '0 2px 4px 0 rgb(0 35 11 / 20%)',
35
- width: 12,
36
- height: 12,
37
- borderRadius: 6,
38
- transition: (theme.transitions as any).create(['width'], {
39
- duration: 200,
40
- }),
41
- },
42
- '& .MuiSwitch-track': {
43
- borderRadius: 16 / 2,
44
- opacity: 1,
45
- backgroundColor: theme.palette.mode === 'dark' ? 'rgba(255,255,255,.35)' : 'rgba(0,0,0,.25)',
46
- boxSizing: 'border-box',
47
- },
48
- }));
@@ -1,54 +0,0 @@
1
- import type { TPaymentCurrency, TPaymentMethodExpanded } from '@did-pay/types';
2
- import { Alert, CircularProgress } from '@mui/material';
3
- import { useLocalStorageState, useRequest } from 'ahooks';
4
- import type { Axios } from 'axios';
5
- import { createContext, useContext } from 'react';
6
-
7
- import api from '../libs/api';
8
-
9
- export interface Settings {
10
- paymentMethods: TPaymentMethodExpanded[];
11
- baseCurrency: TPaymentCurrency;
12
- }
13
-
14
- export type SettingsContextType = {
15
- livemode: boolean;
16
- settings: Settings;
17
- refresh: () => void;
18
- setLivemode: (livemode: boolean) => void;
19
- api: Axios;
20
- };
21
-
22
- // @ts-ignore
23
- const SettingsContext = createContext<SettingsContextType>({ api });
24
- const { Provider, Consumer } = SettingsContext;
25
-
26
- const getSettings = async () => {
27
- const { data } = await api.get('/api/settings');
28
- return data;
29
- };
30
-
31
- // eslint-disable-next-line react/prop-types
32
- function SettingsProvider({ children }: { children: any }): JSX.Element {
33
- const { data, error, run, loading } = useRequest(getSettings);
34
- const [livemode, setLivemode] = useLocalStorageState('livemode', { defaultValue: true });
35
-
36
- if (error) {
37
- return <Alert severity="error">{error.message}</Alert>;
38
- }
39
-
40
- if (loading) {
41
- return <CircularProgress />;
42
- }
43
-
44
- return (
45
- <Provider value={{ livemode: !!livemode, settings: data, refresh: run, setLivemode, api }}>{children}</Provider>
46
- );
47
- }
48
-
49
- function useSettingsContext() {
50
- const context = useContext(SettingsContext);
51
- return context;
52
- }
53
-
54
- export { SettingsContext, SettingsProvider, Consumer as SettingsConsumer, useSettingsContext };