@blocklet/payment-react 1.14.20 → 1.14.22

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 (136) hide show
  1. package/es/checkout/donate.d.ts +2 -1
  2. package/es/checkout/donate.js +9 -10
  3. package/es/checkout/form.d.ts +1 -1
  4. package/es/checkout/form.js +23 -1
  5. package/es/checkout/table.d.ts +1 -1
  6. package/es/checkout/table.js +8 -1
  7. package/es/components/blockchain/tx.js +2 -1
  8. package/es/components/country-select.d.ts +16 -0
  9. package/es/components/country-select.js +82 -0
  10. package/es/components/input.d.ts +21 -21
  11. package/es/components/input.js +43 -42
  12. package/es/components/livemode.js +1 -0
  13. package/es/components/pricing-table.js +0 -2
  14. package/es/components/status.js +2 -3
  15. package/es/components/table.d.ts +2 -0
  16. package/es/components/table.js +186 -0
  17. package/es/contexts/payment.d.ts +2 -0
  18. package/es/contexts/payment.js +5 -2
  19. package/es/history/invoice/list.d.ts +5 -1
  20. package/es/history/invoice/list.js +218 -48
  21. package/es/hooks/mobile.d.ts +4 -0
  22. package/es/hooks/mobile.js +10 -0
  23. package/es/index.d.ts +5 -1
  24. package/es/index.js +7 -1
  25. package/es/libs/util.d.ts +15 -2
  26. package/es/libs/util.js +92 -28
  27. package/es/locales/en.js +23 -7
  28. package/es/locales/index.d.ts +0 -1
  29. package/es/locales/index.js +10 -1
  30. package/es/locales/zh.js +22 -6
  31. package/es/payment/error.js +2 -2
  32. package/es/payment/footer.js +1 -1
  33. package/es/payment/form/address.d.ts +9 -2
  34. package/es/payment/form/address.js +69 -69
  35. package/es/payment/form/currency.js +39 -25
  36. package/es/payment/form/index.d.ts +1 -1
  37. package/es/payment/form/index.js +83 -81
  38. package/es/payment/form/phone.js +15 -51
  39. package/es/payment/index.d.ts +1 -10
  40. package/es/payment/index.js +274 -219
  41. package/es/payment/product-card.js +4 -4
  42. package/es/payment/product-donation.js +7 -2
  43. package/es/payment/product-item.d.ts +2 -2
  44. package/es/payment/product-item.js +120 -81
  45. package/es/payment/summary.js +188 -118
  46. package/es/theme/index.css +240 -0
  47. package/es/theme/index.d.ts +9 -0
  48. package/es/theme/index.js +243 -0
  49. package/es/theme/typography.d.ts +2 -0
  50. package/es/theme/typography.js +53 -0
  51. package/es/types/index.d.ts +11 -0
  52. package/lib/checkout/donate.d.ts +2 -1
  53. package/lib/checkout/donate.js +14 -2
  54. package/lib/checkout/form.d.ts +1 -1
  55. package/lib/checkout/form.js +22 -1
  56. package/lib/checkout/table.d.ts +1 -1
  57. package/lib/checkout/table.js +14 -1
  58. package/lib/components/blockchain/tx.js +4 -1
  59. package/lib/components/country-select.d.ts +16 -0
  60. package/lib/components/country-select.js +115 -0
  61. package/lib/components/input.d.ts +21 -21
  62. package/lib/components/input.js +21 -12
  63. package/lib/components/livemode.js +1 -0
  64. package/lib/components/pricing-table.js +0 -2
  65. package/lib/components/status.js +2 -3
  66. package/lib/components/table.d.ts +2 -0
  67. package/lib/components/table.js +220 -0
  68. package/lib/contexts/payment.d.ts +2 -0
  69. package/lib/contexts/payment.js +4 -1
  70. package/lib/history/invoice/list.d.ts +5 -1
  71. package/lib/history/invoice/list.js +293 -62
  72. package/lib/hooks/mobile.d.ts +4 -0
  73. package/lib/hooks/mobile.js +17 -0
  74. package/lib/index.d.ts +5 -1
  75. package/lib/index.js +36 -0
  76. package/lib/libs/util.d.ts +15 -2
  77. package/lib/libs/util.js +115 -37
  78. package/lib/locales/en.js +23 -7
  79. package/lib/locales/index.d.ts +0 -1
  80. package/lib/locales/index.js +14 -3
  81. package/lib/locales/zh.js +22 -6
  82. package/lib/payment/error.js +5 -1
  83. package/lib/payment/footer.js +1 -1
  84. package/lib/payment/form/address.d.ts +9 -2
  85. package/lib/payment/form/address.js +67 -59
  86. package/lib/payment/form/currency.js +31 -24
  87. package/lib/payment/form/index.d.ts +1 -1
  88. package/lib/payment/form/index.js +92 -93
  89. package/lib/payment/form/phone.js +11 -59
  90. package/lib/payment/index.d.ts +1 -10
  91. package/lib/payment/index.js +291 -219
  92. package/lib/payment/product-card.js +5 -4
  93. package/lib/payment/product-donation.js +9 -2
  94. package/lib/payment/product-item.d.ts +2 -2
  95. package/lib/payment/product-item.js +38 -19
  96. package/lib/payment/summary.js +219 -127
  97. package/lib/theme/index.css +240 -0
  98. package/lib/theme/index.d.ts +9 -0
  99. package/lib/theme/index.js +259 -0
  100. package/lib/theme/typography.d.ts +2 -0
  101. package/lib/theme/typography.js +59 -0
  102. package/lib/types/index.d.ts +11 -0
  103. package/package.json +14 -11
  104. package/src/checkout/donate.tsx +16 -10
  105. package/src/checkout/form.tsx +23 -0
  106. package/src/checkout/table.tsx +13 -1
  107. package/src/components/blockchain/tx.tsx +2 -1
  108. package/src/components/country-select.tsx +93 -0
  109. package/src/components/input.tsx +49 -46
  110. package/src/components/livemode.tsx +1 -0
  111. package/src/components/pricing-table.tsx +0 -2
  112. package/src/components/status.tsx +1 -2
  113. package/src/components/table.tsx +200 -0
  114. package/src/contexts/payment.tsx +6 -1
  115. package/src/history/invoice/list.tsx +258 -49
  116. package/src/hooks/mobile.ts +13 -0
  117. package/src/index.ts +7 -0
  118. package/src/libs/util.ts +120 -31
  119. package/src/locales/en.tsx +19 -4
  120. package/src/locales/index.tsx +10 -3
  121. package/src/locales/zh.tsx +18 -3
  122. package/src/payment/error.tsx +2 -2
  123. package/src/payment/footer.tsx +1 -1
  124. package/src/payment/form/address.tsx +56 -47
  125. package/src/payment/form/currency.tsx +29 -23
  126. package/src/payment/form/index.tsx +89 -76
  127. package/src/payment/form/phone.tsx +14 -51
  128. package/src/payment/index.tsx +294 -242
  129. package/src/payment/product-card.tsx +4 -4
  130. package/src/payment/product-donation.tsx +7 -3
  131. package/src/payment/product-item.tsx +49 -20
  132. package/src/payment/summary.tsx +191 -108
  133. package/src/theme/index.css +240 -0
  134. package/src/theme/index.tsx +250 -0
  135. package/src/theme/typography.ts +56 -0
  136. package/src/types/index.ts +12 -0
@@ -4,22 +4,26 @@ type Props = {
4
4
  subscription_id?: string;
5
5
  currency_id?: string;
6
6
  include_staking?: boolean;
7
+ include_recovered_from?: boolean;
7
8
  status?: string;
8
9
  pageSize?: number;
9
10
  target?: string;
10
11
  action?: string;
12
+ type?: 'list' | 'table';
11
13
  };
12
- declare function CustomerInvoiceList({ customer_id, subscription_id, currency_id, include_staking, status, pageSize, target, action, }: Props): import("react").JSX.Element;
14
+ declare function CustomerInvoiceList(props: Props): JSX.Element;
13
15
  declare namespace CustomerInvoiceList {
14
16
  var defaultProps: {
15
17
  customer_id: string;
16
18
  subscription_id: string;
17
19
  currency_id: string;
18
20
  include_staking: boolean;
21
+ include_recovered_from: boolean;
19
22
  status: string;
20
23
  pageSize: number;
21
24
  target: string;
22
25
  action: string;
26
+ type: string;
23
27
  };
24
28
  }
25
29
  export default CustomerInvoiceList;
@@ -4,8 +4,8 @@ import Toast from "@arcblock/ux/lib/Toast";
4
4
  import { OpenInNewOutlined } from "@mui/icons-material";
5
5
  import { Box, Button, CircularProgress, Hidden, Stack, Typography } from "@mui/material";
6
6
  import { styled } from "@mui/system";
7
- import { useInfiniteScroll, useSetState } from "ahooks";
8
- import { useEffect } from "react";
7
+ import { useInfiniteScroll, useRequest, useSetState } from "ahooks";
8
+ import React, { useEffect, useState } from "react";
9
9
  import { joinURL } from "ufo";
10
10
  import Status from "../../components/status.js";
11
11
  import { usePaymentContext } from "../../contexts/payment.js";
@@ -20,6 +20,7 @@ import {
20
20
  getPrefix,
21
21
  getTxLink
22
22
  } from "../../libs/util.js";
23
+ import Table from "../../components/table.js";
23
24
  const groupByDate = (items) => {
24
25
  const grouped = {};
25
26
  items.forEach((item) => {
@@ -57,21 +58,178 @@ const getInvoiceLink = (invoice, action) => {
57
58
  url: getTxLink(invoice.paymentMethod, invoice.metadata?.payment_details).link
58
59
  };
59
60
  };
60
- export default function CustomerInvoiceList({
61
- customer_id,
62
- subscription_id,
63
- currency_id,
64
- include_staking,
65
- status,
66
- pageSize,
67
- target,
68
- action
69
- }) {
61
+ const InvoiceTable = React.memo((props) => {
62
+ const {
63
+ pageSize,
64
+ target,
65
+ action,
66
+ onPay,
67
+ status,
68
+ customer_id,
69
+ currency_id,
70
+ subscription_id,
71
+ include_staking,
72
+ include_recovered_from
73
+ } = props;
74
+ const listKey = "invoice-table";
75
+ const { t, locale } = useLocaleContext();
76
+ const [search, setSearch] = useState({
77
+ pageSize: pageSize || 10,
78
+ page: 1
79
+ });
80
+ const { loading, data = { list: [], count: 0 } } = useRequest(
81
+ () => fetchData({
82
+ ...search,
83
+ status,
84
+ customer_id,
85
+ currency_id,
86
+ subscription_id,
87
+ include_staking,
88
+ include_recovered_from,
89
+ ignore_zero: true
90
+ }),
91
+ {
92
+ refreshDeps: [search]
93
+ }
94
+ );
95
+ const columns = [
96
+ {
97
+ label: t("payment.customer.invoice.invoiceNumber"),
98
+ name: "number",
99
+ options: {
100
+ customBodyRenderLite: (_, index) => {
101
+ const invoice = data?.list[index];
102
+ const link = getInvoiceLink(invoice, action);
103
+ return /* @__PURE__ */ jsx("a", { href: link.url, target: link.external ? "_blank" : target, rel: "noreferrer", children: invoice?.number });
104
+ }
105
+ }
106
+ },
107
+ {
108
+ label: t("common.amount"),
109
+ name: "total",
110
+ options: {
111
+ customBodyRenderLite: (_, index) => {
112
+ const invoice = data?.list[index];
113
+ const link = getInvoiceLink(invoice, action);
114
+ return /* @__PURE__ */ jsx("a", { href: link.url, target: link.external ? "_blank" : target, rel: "noreferrer", children: /* @__PURE__ */ jsxs(Typography, { children: [
115
+ formatBNStr(invoice.total, invoice.paymentCurrency.decimal),
116
+ "\xA0",
117
+ invoice.paymentCurrency.symbol
118
+ ] }) });
119
+ }
120
+ }
121
+ },
122
+ {
123
+ label: t("common.updatedAt"),
124
+ name: "name",
125
+ options: {
126
+ customBodyRenderLite: (val, index) => {
127
+ const invoice = data?.list[index];
128
+ const link = getInvoiceLink(invoice, action);
129
+ return /* @__PURE__ */ jsx("a", { href: link.url, target: link.external ? "_blank" : target, rel: "noreferrer", children: formatToDate(invoice.created_at, locale, "YYYY-MM-DD HH:mm:ss") });
130
+ }
131
+ }
132
+ },
133
+ {
134
+ label: t("common.description"),
135
+ name: "",
136
+ options: {
137
+ sort: false,
138
+ customBodyRenderLite: (val, index) => {
139
+ const invoice = data?.list[index];
140
+ const link = getInvoiceLink(invoice, action);
141
+ return /* @__PURE__ */ jsx("a", { href: link.url, target: link.external ? "_blank" : target, rel: "noreferrer", children: invoice.description || invoice.id });
142
+ }
143
+ }
144
+ },
145
+ {
146
+ label: t("common.status"),
147
+ name: "created_at",
148
+ options: {
149
+ sort: true,
150
+ customBodyRenderLite: (val, index) => {
151
+ const invoice = data?.list[index];
152
+ const link = getInvoiceLink(invoice, action);
153
+ if (action) {
154
+ return link.connect ? /* @__PURE__ */ jsx(Button, { variant: "text", size: "small", onClick: () => onPay(invoice.id), sx: { color: "text.link" }, children: t("payment.customer.invoice.pay") }) : /* @__PURE__ */ jsx(
155
+ Button,
156
+ {
157
+ component: "a",
158
+ variant: "text",
159
+ size: "small",
160
+ href: link.url,
161
+ target: link.external ? "_blank" : target,
162
+ sx: { color: "var(--foregrounds-fg-interactive, #0086FF) !important" },
163
+ rel: "noreferrer",
164
+ children: t("payment.customer.invoice.pay")
165
+ }
166
+ );
167
+ }
168
+ return /* @__PURE__ */ jsx("a", { href: link.url, target: link.external ? "_blank" : target, rel: "noreferrer", children: /* @__PURE__ */ jsx(Status, { label: invoice.status, color: getInvoiceStatusColor(invoice.status) }) });
169
+ }
170
+ }
171
+ }
172
+ ];
173
+ const onTableChange = ({ page, rowsPerPage }) => {
174
+ if (search.pageSize !== rowsPerPage) {
175
+ setSearch((x) => ({ ...x, pageSize: rowsPerPage, page: 1 }));
176
+ } else if (search.page !== page + 1) {
177
+ setSearch((x) => ({ ...x, page: page + 1 }));
178
+ }
179
+ };
180
+ return /* @__PURE__ */ jsx(InvoiceTableRoot, { children: /* @__PURE__ */ jsx(
181
+ Table,
182
+ {
183
+ hasRowLink: true,
184
+ durable: `__${listKey}__`,
185
+ durableKeys: ["page", "rowsPerPage", "searchText"],
186
+ data: data.list,
187
+ columns,
188
+ options: {
189
+ count: data.count,
190
+ page: search.page - 1,
191
+ rowsPerPage: search.pageSize
192
+ },
193
+ loading,
194
+ onChange: onTableChange,
195
+ toolbar: false,
196
+ sx: { mt: 2 },
197
+ showMobile: false,
198
+ mobileTDFlexDirection: "row",
199
+ emptyNodeText: t("payment.customer.invoice.emptyList")
200
+ }
201
+ ) });
202
+ });
203
+ const InvoiceTableRoot = styled(Box)`
204
+ @media (max-width: ${({ theme }) => theme.breakpoints.values.md}px) {
205
+ .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > td.MuiTableCell-root {
206
+ > div {
207
+ width: fit-content;
208
+ flex: inherit;
209
+ font-size: 14px;
210
+ }
211
+ }
212
+ .invoice-summary {
213
+ padding-right: 20px;
214
+ }
215
+ }
216
+ `;
217
+ const InvoiceList = React.memo((props) => {
218
+ const {
219
+ customer_id,
220
+ subscription_id,
221
+ include_recovered_from,
222
+ currency_id,
223
+ include_staking,
224
+ status,
225
+ pageSize,
226
+ target,
227
+ action,
228
+ onPay
229
+ } = props;
70
230
  const size = pageSize || 10;
71
231
  const subscription = useSubscription("events");
72
232
  const { t, locale } = useLocaleContext();
73
- const { connect } = usePaymentContext();
74
- const [state, setState] = useSetState({ paying: "" });
75
233
  const { data, loadMore, loadingMore, loading, reloadAsync } = useInfiniteScroll(
76
234
  (d) => {
77
235
  const page = d ? Math.ceil(d.list.length / size) + 1 : 1;
@@ -83,11 +241,12 @@ export default function CustomerInvoiceList({
83
241
  currency_id,
84
242
  subscription_id,
85
243
  include_staking,
244
+ include_recovered_from,
86
245
  ignore_zero: true
87
246
  });
88
247
  },
89
248
  {
90
- reloadDeps: [customer_id, subscription_id, status, include_staking]
249
+ reloadDeps: [customer_id, subscription_id, status, include_staking, include_recovered_from]
91
250
  }
92
251
  );
93
252
  useEffect(() => {
@@ -99,36 +258,6 @@ export default function CustomerInvoiceList({
99
258
  });
100
259
  }
101
260
  }, [subscription]);
102
- const onPay = (invoiceId) => {
103
- if (state.paying) {
104
- return;
105
- }
106
- setState({ paying: invoiceId });
107
- connect.open({
108
- action: "collect",
109
- saveConnect: false,
110
- messages: {
111
- scan: "",
112
- title: t(`payment.customer.invoice.${action || "pay"}`),
113
- success: t(`payment.customer.invoice.${action || "pay"}Success`),
114
- error: t(`payment.customer.invoice.${action || "pay"}Error`),
115
- confirm: ""
116
- },
117
- extraParams: { invoiceId, action },
118
- onSuccess: () => {
119
- connect.close();
120
- setState({ paying: "" });
121
- },
122
- onClose: () => {
123
- connect.close();
124
- setState({ paying: "" });
125
- },
126
- onError: (err) => {
127
- setState({ paying: "" });
128
- Toast.error(formatError(err));
129
- }
130
- });
131
- };
132
261
  if (loading || !data) {
133
262
  return /* @__PURE__ */ jsx(CircularProgress, {});
134
263
  }
@@ -174,7 +303,6 @@ export default function CustomerInvoiceList({
174
303
  {
175
304
  component: "a",
176
305
  variant: "contained",
177
- color: "primary",
178
306
  size: "small",
179
307
  href: link.url,
180
308
  target: link.external ? "_blank" : target,
@@ -193,19 +321,61 @@ export default function CustomerInvoiceList({
193
321
  !hasMore && data.count > size && /* @__PURE__ */ jsx(Typography, { color: "text.secondary", children: t("common.noMore", { resource: t("payment.customer.invoices") }) })
194
322
  ] })
195
323
  ] });
324
+ });
325
+ export default function CustomerInvoiceList(props) {
326
+ const { action, type } = props;
327
+ const { t } = useLocaleContext();
328
+ const { connect } = usePaymentContext();
329
+ const [state, setState] = useSetState({ paying: "" });
330
+ const onPay = (invoiceId) => {
331
+ if (state.paying) {
332
+ return;
333
+ }
334
+ setState({ paying: invoiceId });
335
+ connect.open({
336
+ action: "collect",
337
+ saveConnect: false,
338
+ messages: {
339
+ scan: "",
340
+ title: t(`payment.customer.invoice.${action || "pay"}`),
341
+ success: t(`payment.customer.invoice.${action || "pay"}Success`),
342
+ error: t(`payment.customer.invoice.${action || "pay"}Error`),
343
+ confirm: ""
344
+ },
345
+ extraParams: { invoiceId, action },
346
+ onSuccess: () => {
347
+ connect.close();
348
+ setState({ paying: "" });
349
+ },
350
+ onClose: () => {
351
+ connect.close();
352
+ setState({ paying: "" });
353
+ },
354
+ onError: (err) => {
355
+ setState({ paying: "" });
356
+ Toast.error(formatError(err));
357
+ }
358
+ });
359
+ };
360
+ if (type === "table") {
361
+ return /* @__PURE__ */ jsx(InvoiceTable, { ...props, onPay });
362
+ }
363
+ return /* @__PURE__ */ jsx(InvoiceList, { ...props, onPay });
196
364
  }
197
365
  CustomerInvoiceList.defaultProps = {
198
366
  customer_id: "",
199
367
  subscription_id: "",
200
368
  currency_id: "",
201
369
  include_staking: false,
370
+ include_recovered_from: false,
202
371
  status: "open,paid,uncollectible",
203
372
  pageSize: 10,
204
373
  target: "_self",
205
- action: ""
374
+ action: "",
375
+ type: "list"
206
376
  };
207
377
  const Root = styled(Stack)`
208
- @media (max-width: 600px) {
378
+ @media (max-width: ${({ theme }) => theme.breakpoints.values.md}px) {
209
379
  .invoice-description {
210
380
  display: none !important;
211
381
  }
@@ -0,0 +1,4 @@
1
+ export declare function useMobile(mobilePoint?: 'md' | 'sm' | 'lg' | 'xl' | 'xs'): {
2
+ isMobile: boolean;
3
+ mobileSize: string;
4
+ };
@@ -0,0 +1,10 @@
1
+ import { useTheme } from "@mui/material/styles";
2
+ import useMediaQuery from "@mui/material/useMediaQuery";
3
+ const MOBILE_POINT = "md";
4
+ export function useMobile(mobilePoint = MOBILE_POINT) {
5
+ const theme = useTheme();
6
+ return {
7
+ isMobile: useMediaQuery(theme.breakpoints.down(mobilePoint)),
8
+ mobileSize: `${theme.breakpoints.values[mobilePoint]}px`
9
+ };
10
+ }
package/es/index.d.ts CHANGED
@@ -7,6 +7,7 @@ import ConfirmDialog from './components/confirm';
7
7
  import FormInput from './components/input';
8
8
  import Livemode from './components/livemode';
9
9
  import PricingTable from './components/pricing-table';
10
+ import Table from './components/table';
10
11
  import SafeGuard from './components/safe-guard';
11
12
  import Status from './components/status';
12
13
  import Switch from './components/switch-button';
@@ -23,9 +24,12 @@ import Payment from './payment/index';
23
24
  import ProductSkeleton from './payment/product-skeleton';
24
25
  import PaymentSummary from './payment/summary';
25
26
  import PricingItem from './components/pricing-item';
27
+ import CountrySelect from './components/country-select';
28
+ export { PaymentThemeProvider } from './theme';
26
29
  export * from './libs/util';
27
30
  export * from './libs/connect';
28
31
  export * from './contexts/payment';
29
32
  export * from './hooks/subscription';
33
+ export * from './hooks/mobile';
30
34
  export { translations, createTranslator } from './locales';
31
- export { api, dayjs, FormInput, PhoneInput, AddressForm, StripeForm, Status, Livemode, Switch, ConfirmDialog, CheckoutForm, CheckoutTable, CheckoutDonate, CurrencySelector, Payment, PaymentSummary, PricingTable, ProductSkeleton, Amount, CustomerInvoiceList, CustomerPaymentList, TxLink, TxGas, SafeGuard, PricingItem, };
35
+ export { api, dayjs, FormInput, PhoneInput, AddressForm, StripeForm, Status, Livemode, Switch, ConfirmDialog, CheckoutForm, CheckoutTable, CheckoutDonate, CurrencySelector, Payment, PaymentSummary, PricingTable, ProductSkeleton, Amount, CustomerInvoiceList, CustomerPaymentList, TxLink, TxGas, SafeGuard, PricingItem, CountrySelect, Table, };
package/es/index.js CHANGED
@@ -7,6 +7,7 @@ import ConfirmDialog from "./components/confirm.js";
7
7
  import FormInput from "./components/input.js";
8
8
  import Livemode from "./components/livemode.js";
9
9
  import PricingTable from "./components/pricing-table.js";
10
+ import Table from "./components/table.js";
10
11
  import SafeGuard from "./components/safe-guard.js";
11
12
  import Status from "./components/status.js";
12
13
  import Switch from "./components/switch-button.js";
@@ -23,10 +24,13 @@ import Payment from "./payment/index.js";
23
24
  import ProductSkeleton from "./payment/product-skeleton.js";
24
25
  import PaymentSummary from "./payment/summary.js";
25
26
  import PricingItem from "./components/pricing-item.js";
27
+ import CountrySelect from "./components/country-select.js";
28
+ export { PaymentThemeProvider } from "./theme/index.js";
26
29
  export * from "./libs/util.js";
27
30
  export * from "./libs/connect.js";
28
31
  export * from "./contexts/payment.js";
29
32
  export * from "./hooks/subscription.js";
33
+ export * from "./hooks/mobile.js";
30
34
  export { translations, createTranslator } from "./locales/index.js";
31
35
  export {
32
36
  api,
@@ -53,5 +57,7 @@ export {
53
57
  TxLink,
54
58
  TxGas,
55
59
  SafeGuard,
56
- PricingItem
60
+ PricingItem,
61
+ CountrySelect,
62
+ Table
57
63
  };
package/es/libs/util.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import type { PaymentDetails, PriceCurrency, PriceRecurring, TLineItemExpanded, TPaymentCurrency, TPaymentCurrencyExpanded, TPaymentMethod, TPaymentMethodExpanded, TPrice, TProductExpanded, TSubscriptionExpanded, TSubscriptionItemExpanded } from '@blocklet/payment-types';
3
- import { PricingRenderProps } from '../types';
3
+ import { ActionProps, PricingRenderProps } from '../types';
4
4
  export declare const PAYMENT_KIT_DID = "z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk";
5
5
  export declare const isPaymentKitMounted: () => any;
6
6
  export declare const getPrefix: () => string;
@@ -40,11 +40,21 @@ export declare function getCheckoutAmount(items: TLineItemExpanded[], currency:
40
40
  };
41
41
  export declare function getRecurringPeriod(recurring: PriceRecurring): number;
42
42
  export declare function formatUpsellSaving(items: TLineItemExpanded[], currency: TPaymentCurrency): string;
43
+ export declare function formatMeteredThen(subscription: string, recurring: string, hasMetered: boolean, locale?: string): string;
44
+ export declare function formatPriceDisplay({ amount, then, actualAmount, showThen }: {
45
+ amount: string;
46
+ then?: string;
47
+ actualAmount: string;
48
+ showThen?: boolean;
49
+ }, recurring: string, hasMetered: boolean, locale?: string): string;
43
50
  export declare function formatCheckoutHeadlines(items: TLineItemExpanded[], currency: TPaymentCurrency, trialInDays: number, locale?: string): {
44
51
  action: string;
45
52
  amount: string;
46
53
  then?: string;
47
54
  secondary?: string;
55
+ showThen?: boolean;
56
+ actualAmount: string;
57
+ priceDisplay: string;
48
58
  };
49
59
  export declare function formatAmount(amount: string, decimals: number): string;
50
60
  export declare function findCurrency(methods: TPaymentMethodExpanded[], currencyId: string): TPaymentCurrencyExpanded | null;
@@ -53,11 +63,13 @@ export declare function stopEvent(e: React.SyntheticEvent<any>): void;
53
63
  export declare function sleep(ms: number): Promise<unknown>;
54
64
  export declare function formatSubscriptionProduct(items: TSubscriptionItemExpanded[], maxLength?: number): string;
55
65
  export declare const getSubscriptionTimeSummary: (subscription: TSubscriptionExpanded) => string;
56
- export declare const getSubscriptionAction: (subscription: TSubscriptionExpanded) => {
66
+ export declare const getSubscriptionAction: (subscription: TSubscriptionExpanded, actionProps: ActionProps) => {
57
67
  action: string;
58
68
  variant: string;
59
69
  color: string;
60
70
  canRenew: boolean;
71
+ text?: string;
72
+ sx?: any;
61
73
  } | null;
62
74
  export declare const mergeExtraParams: (extra?: Record<string, any>) => string;
63
75
  export declare const flattenPaymentMethods: (methods?: TPaymentMethodExpanded[]) => import("sequelize").InferAttributes<import("@blocklet/payment-types").PaymentCurrency, {
@@ -77,4 +89,5 @@ export declare function formatTotalPrice({ product, quantity, priceId, locale, }
77
89
  locale: string;
78
90
  }): PricingRenderProps;
79
91
  export declare function formatQuantityInventory(price: TPrice, quantity: string | number, locale?: string): string;
92
+ export declare function formatSubscriptionStatus(status: string): string;
80
93
  export declare function formatAmountPrecisionLimit(amount: string, locale?: string, precision?: number): string;