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.
- package/api/src/libs/notification/template/subscription-trial-will-end.ts +1 -1
- package/api/src/libs/notification/template/subscription-will-renew.ts +1 -1
- package/blocklet.yml +1 -1
- package/package.json +6 -6
- package/src/components/actions.tsx +1 -2
- package/src/components/blockchain/tx.tsx +1 -1
- package/src/components/click-boundary.tsx +1 -2
- package/src/components/customer/actions.tsx +2 -3
- package/src/components/customer/edit.tsx +3 -3
- package/src/components/customer/form.tsx +22 -24
- package/src/components/drawer-form.tsx +2 -4
- package/src/components/event/list.tsx +2 -3
- package/src/components/invoice/action.tsx +2 -3
- package/src/components/invoice/list.tsx +3 -4
- package/src/components/invoice/table.tsx +7 -7
- package/src/components/metadata/form.tsx +3 -4
- package/src/components/passport/actions.tsx +1 -2
- package/src/components/passport/assign.tsx +1 -1
- package/src/components/payment-intent/actions.tsx +2 -3
- package/src/components/payment-intent/list.tsx +3 -4
- package/src/components/payment-link/actions.tsx +2 -3
- package/src/components/payment-link/item.tsx +3 -5
- package/src/components/payment-link/product-select.tsx +3 -4
- package/src/components/payment-link/rename.tsx +3 -4
- package/src/components/payment-method/arcblock.tsx +1 -2
- package/src/components/payment-method/bitcoin.tsx +1 -2
- package/src/components/payment-method/ethereum.tsx +1 -2
- package/src/components/payment-method/stripe.tsx +1 -2
- package/src/components/portal/invoice/list.tsx +4 -5
- package/src/components/portal/subscription/actions.tsx +7 -8
- package/src/components/portal/subscription/cancel.tsx +13 -12
- package/src/components/portal/subscription/list.tsx +4 -10
- package/src/components/price/currency-select.tsx +2 -2
- package/src/components/price/form.tsx +3 -4
- package/src/components/price/upsell-select.tsx +2 -3
- package/src/components/price/upsell.tsx +3 -5
- package/src/components/pricing-table/actions.tsx +2 -3
- package/src/components/pricing-table/payment-settings.tsx +4 -4
- package/src/components/pricing-table/price-item.tsx +4 -7
- package/src/components/pricing-table/product-item.tsx +3 -3
- package/src/components/pricing-table/rename.tsx +3 -4
- package/src/components/product/actions.tsx +2 -3
- package/src/components/product/add-price.tsx +2 -2
- package/src/components/product/create.tsx +2 -4
- package/src/components/product/cross-sell-select.tsx +3 -3
- package/src/components/product/cross-sell.tsx +4 -5
- package/src/components/product/edit.tsx +1 -1
- package/src/components/product/form.tsx +6 -6
- package/src/components/relative-time.tsx +1 -2
- package/src/components/subscription/actions/cancel.tsx +2 -3
- package/src/components/subscription/actions/index.tsx +2 -3
- package/src/components/subscription/items/actions.tsx +1 -1
- package/src/components/subscription/items/index.tsx +2 -2
- package/src/components/subscription/items/usage-records.tsx +2 -3
- package/src/components/subscription/list.tsx +3 -4
- package/src/components/subscription/metrics.tsx +2 -2
- package/src/components/subscription/status.tsx +3 -3
- package/src/components/webhook/attempts.tsx +3 -3
- package/src/contexts/products.tsx +2 -3
- package/src/libs/api.ts +2 -19
- package/src/libs/dayjs.ts +1 -15
- package/src/libs/util.ts +24 -555
- package/src/locales/en.tsx +0 -139
- package/src/locales/index.tsx +5 -23
- package/src/locales/zh.tsx +0 -136
- package/src/pages/admin/billing/invoices/detail.tsx +3 -4
- package/src/pages/admin/billing/subscriptions/detail.tsx +3 -3
- package/src/pages/admin/customers/customers/detail.tsx +3 -5
- package/src/pages/admin/customers/customers/index.tsx +2 -3
- package/src/pages/admin/developers/events/detail.tsx +2 -3
- package/src/pages/admin/developers/webhooks/detail.tsx +3 -4
- package/src/pages/admin/developers/webhooks/index.tsx +3 -4
- package/src/pages/admin/index.tsx +6 -5
- package/src/pages/admin/payments/intents/detail.tsx +4 -6
- package/src/pages/admin/payments/links/create.tsx +3 -5
- package/src/pages/admin/payments/links/detail.tsx +4 -5
- package/src/pages/admin/payments/links/index.tsx +4 -6
- package/src/pages/admin/products/passports/index.tsx +1 -1
- package/src/pages/admin/products/prices/actions.tsx +2 -3
- package/src/pages/admin/products/prices/detail.tsx +2 -3
- package/src/pages/admin/products/prices/list.tsx +2 -4
- package/src/pages/admin/products/pricing-tables/create.tsx +2 -3
- package/src/pages/admin/products/pricing-tables/detail.tsx +4 -5
- package/src/pages/admin/products/pricing-tables/index.tsx +2 -4
- package/src/pages/admin/products/products/create.tsx +2 -4
- package/src/pages/admin/products/products/detail.tsx +4 -5
- package/src/pages/admin/products/products/index.tsx +4 -6
- package/src/pages/admin/settings/payment-methods/create.tsx +3 -5
- package/src/pages/admin/settings/payment-methods/index.tsx +2 -3
- package/src/pages/checkout/index.tsx +6 -3
- package/src/pages/checkout/pay.tsx +3 -67
- package/src/pages/checkout/pricing-table.tsx +4 -128
- package/src/pages/customer/index.tsx +7 -7
- package/src/pages/customer/invoice.tsx +10 -11
- package/src/pages/customer/subscription/detail.tsx +4 -4
- package/src/pages/customer/subscription/update.tsx +19 -19
- package/src/components/checkout/amount.tsx +0 -24
- package/src/components/checkout/error.tsx +0 -30
- package/src/components/checkout/footer.tsx +0 -12
- package/src/components/checkout/form/address.tsx +0 -119
- package/src/components/checkout/form/index.tsx +0 -400
- package/src/components/checkout/form/phone.tsx +0 -103
- package/src/components/checkout/form/stripe.tsx +0 -195
- package/src/components/checkout/form/user-buttons.tsx +0 -24
- package/src/components/checkout/header.tsx +0 -40
- package/src/components/checkout/pay.tsx +0 -385
- package/src/components/checkout/pricing-table.tsx +0 -205
- package/src/components/checkout/product-card.tsx +0 -52
- package/src/components/checkout/product-item.tsx +0 -111
- package/src/components/checkout/skeleton/overview.tsx +0 -21
- package/src/components/checkout/skeleton/payment.tsx +0 -35
- package/src/components/checkout/success.tsx +0 -183
- package/src/components/checkout/summary.tsx +0 -198
- package/src/components/input.tsx +0 -58
- package/src/components/livemode.tsx +0 -23
- package/src/components/pricing-table/product-skeleton.tsx +0 -39
- package/src/components/status.tsx +0 -19
- package/src/components/switch.tsx +0 -48
- 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 };
|