payment-kit 1.13.111 → 1.13.113
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/api/src/routes/products.ts +1 -0
- package/api/src/routes/subscriptions.ts +2 -0
- 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/index.tsx +4 -2
- 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/customers/index.tsx +4 -2
- package/src/pages/admin/developers/events/detail.tsx +2 -3
- package/src/pages/admin/developers/index.tsx +4 -2
- 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 +10 -7
- package/src/pages/admin/payments/index.tsx +4 -2
- 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/index.tsx +4 -2
- 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 +5 -69
- package/src/pages/checkout/pricing-table.tsx +3 -7
- 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,5 +1,5 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
-
import type { TLineItemExpanded } from '@
|
|
2
|
+
import type { TLineItemExpanded } from '@blocklet/payment-types';
|
|
3
3
|
import { useNavigate } from 'react-router-dom';
|
|
4
4
|
|
|
5
5
|
import Actions from '../../actions';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
3
|
-
import
|
|
3
|
+
import { formatPrice } from '@blocklet/payment-react';
|
|
4
|
+
import type { TPaymentCurrency, TSubscriptionItemExpanded } from '@blocklet/payment-types';
|
|
4
5
|
import { Stack, Typography } from '@mui/material';
|
|
5
6
|
|
|
6
|
-
import { formatPrice } from '../../../libs/util';
|
|
7
7
|
import Copyable from '../../copyable';
|
|
8
8
|
import Table from '../../table';
|
|
9
9
|
import LineItemActions from './actions';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
-
import
|
|
2
|
+
import { api, formatToDatetime } from '@blocklet/payment-react';
|
|
3
|
+
import type { TUsageRecord } from '@blocklet/payment-types';
|
|
3
4
|
import { Alert, Box, Button, CircularProgress } from '@mui/material';
|
|
4
5
|
import { useRequest } from 'ahooks';
|
|
5
6
|
import { useState } from 'react';
|
|
6
7
|
|
|
7
|
-
import api from '../../../libs/api';
|
|
8
|
-
import { formatToDatetime } from '../../../libs/util';
|
|
9
8
|
import ConfirmDialog from '../../confirm';
|
|
10
9
|
import Table from '../../table';
|
|
11
10
|
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import { getDurableData } from '@arcblock/ux/lib/Datatable';
|
|
3
3
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
4
|
-
import
|
|
4
|
+
import { Status, api, formatTime } from '@blocklet/payment-react';
|
|
5
|
+
import type { TSubscriptionExpanded } from '@blocklet/payment-types';
|
|
5
6
|
import { Alert, CircularProgress, ToggleButton, ToggleButtonGroup } from '@mui/material';
|
|
6
7
|
import { useRequest } from 'ahooks';
|
|
7
8
|
import { useEffect, useState } from 'react';
|
|
8
9
|
import { useNavigate } from 'react-router-dom';
|
|
9
10
|
|
|
10
|
-
import
|
|
11
|
-
import { formatSubscriptionProduct, formatTime } from '../../libs/util';
|
|
12
|
-
import Status from '../status';
|
|
11
|
+
import { formatSubscriptionProduct } from '../../libs/util';
|
|
13
12
|
import Table from '../table';
|
|
14
13
|
import SubscriptionActions from './actions';
|
|
15
14
|
import SubscriptionStatus from './status';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
-
import
|
|
2
|
+
import { formatTime } from '@blocklet/payment-react';
|
|
3
|
+
import type { TSubscriptionExpanded } from '@blocklet/payment-types';
|
|
3
4
|
|
|
4
|
-
import { formatTime } from '../../libs/util';
|
|
5
5
|
import InfoMetric from '../info-metric';
|
|
6
6
|
|
|
7
7
|
type Props = {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
|
|
2
|
-
import
|
|
2
|
+
import { Status, formatToDate } from '@blocklet/payment-react';
|
|
3
|
+
import type { TSubscription } from '@blocklet/payment-types';
|
|
3
4
|
import { AccessTimeOutlined } from '@mui/icons-material';
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
import Status from '../status';
|
|
6
|
+
import { getSubscriptionStatusColor } from '../../libs/util';
|
|
7
7
|
|
|
8
8
|
export default function SubscriptionStatus({
|
|
9
9
|
subscription,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/* eslint-disable react/no-unstable-nested-components */
|
|
2
2
|
import CodeBlock from '@arcblock/ux/lib/CodeBlock';
|
|
3
|
-
import
|
|
3
|
+
import { api, formatTime } from '@blocklet/payment-react';
|
|
4
|
+
import type { Paginated, TEvent, TWebhookAttemptExpanded } from '@blocklet/payment-types';
|
|
4
5
|
import { CheckCircleOutlined, ErrorOutlined } from '@mui/icons-material';
|
|
5
6
|
import {
|
|
6
7
|
Box,
|
|
@@ -18,8 +19,7 @@ import {
|
|
|
18
19
|
import { useInfiniteScroll } from 'ahooks';
|
|
19
20
|
import React, { useEffect, useState } from 'react';
|
|
20
21
|
|
|
21
|
-
import
|
|
22
|
-
import { formatTime, isSuccessAttempt } from '../../libs/util';
|
|
22
|
+
import { isSuccessAttempt } from '../../libs/util';
|
|
23
23
|
|
|
24
24
|
const fetchData = (params: Record<string, any> = {}): Promise<Paginated<TWebhookAttemptExpanded>> => {
|
|
25
25
|
const search = new URLSearchParams();
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { api } from '@blocklet/payment-react';
|
|
2
|
+
import type { TProductExpanded } from '@blocklet/payment-types';
|
|
2
3
|
import { Alert, CircularProgress } from '@mui/material';
|
|
3
4
|
import { useRequest } from 'ahooks';
|
|
4
5
|
import { createContext, useContext } from 'react';
|
|
5
6
|
|
|
6
|
-
import api from '../libs/api';
|
|
7
|
-
|
|
8
7
|
type ProductsContextType = {
|
|
9
8
|
products: TProductExpanded[];
|
|
10
9
|
refresh: () => void;
|
package/src/libs/api.ts
CHANGED
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import axios from 'axios';
|
|
3
|
-
import isNull from 'lodash/isNull';
|
|
1
|
+
import { api } from '@blocklet/payment-react';
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
(config) => {
|
|
7
|
-
const prefix = window.blocklet ? window.blocklet.prefix : '/';
|
|
8
|
-
config.baseURL = prefix || '';
|
|
9
|
-
config.timeout = 200000;
|
|
10
|
-
|
|
11
|
-
const livemode = localStorage.getItem('livemode');
|
|
12
|
-
const locale = getLocale(window.blocklet.languages);
|
|
13
|
-
config.params = { ...(config.params || {}), livemode: isNull(livemode) ? true : JSON.parse(livemode), locale };
|
|
14
|
-
|
|
15
|
-
return config;
|
|
16
|
-
},
|
|
17
|
-
(error) => Promise.reject(error)
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
export default axios;
|
|
3
|
+
export default api;
|
package/src/libs/dayjs.ts
CHANGED
|
@@ -1,17 +1,3 @@
|
|
|
1
|
-
import dayjs from '
|
|
2
|
-
import duration from 'dayjs/plugin/duration';
|
|
3
|
-
import localizedFormat from 'dayjs/plugin/localizedFormat';
|
|
4
|
-
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
5
|
-
import timezone from 'dayjs/plugin/timezone'; // dependent on utc plugin
|
|
6
|
-
import utc from 'dayjs/plugin/utc';
|
|
7
|
-
|
|
8
|
-
import('dayjs/locale/en');
|
|
9
|
-
import('dayjs/locale/zh');
|
|
10
|
-
|
|
11
|
-
dayjs.extend(relativeTime);
|
|
12
|
-
dayjs.extend(localizedFormat);
|
|
13
|
-
dayjs.extend(duration);
|
|
14
|
-
dayjs.extend(utc);
|
|
15
|
-
dayjs.extend(timezone);
|
|
1
|
+
import { dayjs } from '@blocklet/payment-react';
|
|
16
2
|
|
|
17
3
|
export default dayjs;
|