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.
Files changed (126) 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/api/src/routes/products.ts +1 -0
  4. package/api/src/routes/subscriptions.ts +2 -0
  5. package/blocklet.yml +1 -1
  6. package/package.json +6 -6
  7. package/src/components/actions.tsx +1 -2
  8. package/src/components/blockchain/tx.tsx +1 -1
  9. package/src/components/click-boundary.tsx +1 -2
  10. package/src/components/customer/actions.tsx +2 -3
  11. package/src/components/customer/edit.tsx +3 -3
  12. package/src/components/customer/form.tsx +22 -24
  13. package/src/components/drawer-form.tsx +2 -4
  14. package/src/components/event/list.tsx +2 -3
  15. package/src/components/invoice/action.tsx +2 -3
  16. package/src/components/invoice/list.tsx +3 -4
  17. package/src/components/invoice/table.tsx +7 -7
  18. package/src/components/metadata/form.tsx +3 -4
  19. package/src/components/passport/actions.tsx +1 -2
  20. package/src/components/passport/assign.tsx +1 -1
  21. package/src/components/payment-intent/actions.tsx +2 -3
  22. package/src/components/payment-intent/list.tsx +3 -4
  23. package/src/components/payment-link/actions.tsx +2 -3
  24. package/src/components/payment-link/item.tsx +3 -5
  25. package/src/components/payment-link/product-select.tsx +3 -4
  26. package/src/components/payment-link/rename.tsx +3 -4
  27. package/src/components/payment-method/arcblock.tsx +1 -2
  28. package/src/components/payment-method/bitcoin.tsx +1 -2
  29. package/src/components/payment-method/ethereum.tsx +1 -2
  30. package/src/components/payment-method/stripe.tsx +1 -2
  31. package/src/components/portal/invoice/list.tsx +4 -5
  32. package/src/components/portal/subscription/actions.tsx +7 -8
  33. package/src/components/portal/subscription/cancel.tsx +13 -12
  34. package/src/components/portal/subscription/list.tsx +4 -10
  35. package/src/components/price/currency-select.tsx +2 -2
  36. package/src/components/price/form.tsx +3 -4
  37. package/src/components/price/upsell-select.tsx +2 -3
  38. package/src/components/price/upsell.tsx +3 -5
  39. package/src/components/pricing-table/actions.tsx +2 -3
  40. package/src/components/pricing-table/payment-settings.tsx +4 -4
  41. package/src/components/pricing-table/price-item.tsx +4 -7
  42. package/src/components/pricing-table/product-item.tsx +3 -3
  43. package/src/components/pricing-table/rename.tsx +3 -4
  44. package/src/components/product/actions.tsx +2 -3
  45. package/src/components/product/add-price.tsx +2 -2
  46. package/src/components/product/create.tsx +2 -4
  47. package/src/components/product/cross-sell-select.tsx +3 -3
  48. package/src/components/product/cross-sell.tsx +4 -5
  49. package/src/components/product/edit.tsx +1 -1
  50. package/src/components/product/form.tsx +6 -6
  51. package/src/components/relative-time.tsx +1 -2
  52. package/src/components/subscription/actions/cancel.tsx +2 -3
  53. package/src/components/subscription/actions/index.tsx +2 -3
  54. package/src/components/subscription/items/actions.tsx +1 -1
  55. package/src/components/subscription/items/index.tsx +2 -2
  56. package/src/components/subscription/items/usage-records.tsx +2 -3
  57. package/src/components/subscription/list.tsx +3 -4
  58. package/src/components/subscription/metrics.tsx +2 -2
  59. package/src/components/subscription/status.tsx +3 -3
  60. package/src/components/webhook/attempts.tsx +3 -3
  61. package/src/contexts/products.tsx +2 -3
  62. package/src/libs/api.ts +2 -19
  63. package/src/libs/dayjs.ts +1 -15
  64. package/src/libs/util.ts +24 -555
  65. package/src/locales/en.tsx +0 -139
  66. package/src/locales/index.tsx +5 -23
  67. package/src/locales/zh.tsx +0 -136
  68. package/src/pages/admin/billing/index.tsx +4 -2
  69. package/src/pages/admin/billing/invoices/detail.tsx +3 -4
  70. package/src/pages/admin/billing/subscriptions/detail.tsx +3 -3
  71. package/src/pages/admin/customers/customers/detail.tsx +3 -5
  72. package/src/pages/admin/customers/customers/index.tsx +2 -3
  73. package/src/pages/admin/customers/index.tsx +4 -2
  74. package/src/pages/admin/developers/events/detail.tsx +2 -3
  75. package/src/pages/admin/developers/index.tsx +4 -2
  76. package/src/pages/admin/developers/webhooks/detail.tsx +3 -4
  77. package/src/pages/admin/developers/webhooks/index.tsx +3 -4
  78. package/src/pages/admin/index.tsx +10 -7
  79. package/src/pages/admin/payments/index.tsx +4 -2
  80. package/src/pages/admin/payments/intents/detail.tsx +4 -6
  81. package/src/pages/admin/payments/links/create.tsx +3 -5
  82. package/src/pages/admin/payments/links/detail.tsx +4 -5
  83. package/src/pages/admin/payments/links/index.tsx +4 -6
  84. package/src/pages/admin/products/passports/index.tsx +1 -1
  85. package/src/pages/admin/products/prices/actions.tsx +2 -3
  86. package/src/pages/admin/products/prices/detail.tsx +2 -3
  87. package/src/pages/admin/products/prices/list.tsx +2 -4
  88. package/src/pages/admin/products/pricing-tables/create.tsx +2 -3
  89. package/src/pages/admin/products/pricing-tables/detail.tsx +4 -5
  90. package/src/pages/admin/products/pricing-tables/index.tsx +2 -4
  91. package/src/pages/admin/products/products/create.tsx +2 -4
  92. package/src/pages/admin/products/products/detail.tsx +4 -5
  93. package/src/pages/admin/products/products/index.tsx +4 -6
  94. package/src/pages/admin/settings/index.tsx +4 -2
  95. package/src/pages/admin/settings/payment-methods/create.tsx +3 -5
  96. package/src/pages/admin/settings/payment-methods/index.tsx +2 -3
  97. package/src/pages/checkout/index.tsx +6 -3
  98. package/src/pages/checkout/pay.tsx +5 -69
  99. package/src/pages/checkout/pricing-table.tsx +3 -7
  100. package/src/pages/customer/index.tsx +7 -7
  101. package/src/pages/customer/invoice.tsx +10 -11
  102. package/src/pages/customer/subscription/detail.tsx +4 -4
  103. package/src/pages/customer/subscription/update.tsx +19 -19
  104. package/src/components/checkout/amount.tsx +0 -24
  105. package/src/components/checkout/error.tsx +0 -30
  106. package/src/components/checkout/footer.tsx +0 -12
  107. package/src/components/checkout/form/address.tsx +0 -119
  108. package/src/components/checkout/form/index.tsx +0 -400
  109. package/src/components/checkout/form/phone.tsx +0 -103
  110. package/src/components/checkout/form/stripe.tsx +0 -195
  111. package/src/components/checkout/form/user-buttons.tsx +0 -24
  112. package/src/components/checkout/header.tsx +0 -40
  113. package/src/components/checkout/pay.tsx +0 -385
  114. package/src/components/checkout/pricing-table.tsx +0 -205
  115. package/src/components/checkout/product-card.tsx +0 -52
  116. package/src/components/checkout/product-item.tsx +0 -111
  117. package/src/components/checkout/skeleton/overview.tsx +0 -21
  118. package/src/components/checkout/skeleton/payment.tsx +0 -35
  119. package/src/components/checkout/success.tsx +0 -183
  120. package/src/components/checkout/summary.tsx +0 -198
  121. package/src/components/input.tsx +0 -58
  122. package/src/components/livemode.tsx +0 -23
  123. package/src/components/pricing-table/product-skeleton.tsx +0 -39
  124. package/src/components/status.tsx +0 -19
  125. package/src/components/switch.tsx +0 -48
  126. 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 '@did-pay/types';
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 type { TPaymentCurrency, TSubscriptionItemExpanded } from '@did-pay/types';
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 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;