payment-kit 1.13.112 → 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.
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 +3 -7
  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,11 +1,10 @@
1
1
  import { useLocaleContext } from '@arcblock/ux/lib/Locale/context';
2
- import type { TUsageRecord } from '@did-pay/types';
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 type { TSubscriptionExpanded } from '@did-pay/types';
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 api from '../../libs/api';
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 type { TSubscriptionExpanded } from '@did-pay/types';
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 type { TSubscription } from '@did-pay/types';
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 { formatToDate, getSubscriptionStatusColor } from '../../libs/util';
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 type { Paginated, TEvent, TWebhookAttemptExpanded } from '@did-pay/types';
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 api from '../../libs/api';
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 type { TProductExpanded } from '@did-pay/types';
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 { getLocale } from '@arcblock/ux/lib/Locale/context';
2
- import axios from 'axios';
3
- import isNull from 'lodash/isNull';
1
+ import { api } from '@blocklet/payment-react';
4
2
 
5
- axios.interceptors.request.use(
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 'dayjs';
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;