@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
@@ -11,13 +11,16 @@ var _iconsMaterial = require("@mui/icons-material");
11
11
  var _material = require("@mui/material");
12
12
  var _system = require("@mui/system");
13
13
  var _ahooks = require("ahooks");
14
- var _react = require("react");
14
+ var _react = _interopRequireWildcard(require("react"));
15
15
  var _ufo = require("ufo");
16
16
  var _status = _interopRequireDefault(require("../../components/status"));
17
17
  var _payment = require("../../contexts/payment");
18
18
  var _subscription = require("../../hooks/subscription");
19
19
  var _api = _interopRequireDefault(require("../../libs/api"));
20
20
  var _util = require("../../libs/util");
21
+ var _table = _interopRequireDefault(require("../../components/table"));
22
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
23
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22
25
  const groupByDate = items => {
23
26
  const grouped = {};
@@ -53,28 +56,227 @@ const getInvoiceLink = (invoice, action) => {
53
56
  url: (0, _util.getTxLink)(invoice.paymentMethod, invoice.metadata?.payment_details).link
54
57
  };
55
58
  };
56
- function CustomerInvoiceList({
57
- customer_id,
58
- subscription_id,
59
- currency_id,
60
- include_staking,
61
- status,
62
- pageSize,
63
- target,
64
- action
65
- }) {
66
- const size = pageSize || 10;
67
- const subscription = (0, _subscription.useSubscription)("events");
59
+ const InvoiceTable = _react.default.memo(props => {
60
+ const {
61
+ pageSize,
62
+ target,
63
+ action,
64
+ onPay,
65
+ status,
66
+ customer_id,
67
+ currency_id,
68
+ subscription_id,
69
+ include_staking,
70
+ include_recovered_from
71
+ } = props;
72
+ const listKey = "invoice-table";
68
73
  const {
69
74
  t,
70
75
  locale
71
76
  } = (0, _context.useLocaleContext)();
77
+ const [search, setSearch] = (0, _react.useState)({
78
+ pageSize: pageSize || 10,
79
+ page: 1
80
+ });
72
81
  const {
73
- connect
74
- } = (0, _payment.usePaymentContext)();
75
- const [state, setState] = (0, _ahooks.useSetState)({
76
- paying: ""
82
+ loading,
83
+ data = {
84
+ list: [],
85
+ count: 0
86
+ }
87
+ } = (0, _ahooks.useRequest)(() => fetchData({
88
+ ...search,
89
+ status,
90
+ customer_id,
91
+ currency_id,
92
+ subscription_id,
93
+ include_staking,
94
+ include_recovered_from,
95
+ ignore_zero: true
96
+ }), {
97
+ refreshDeps: [search]
77
98
  });
99
+ const columns = [{
100
+ label: t("payment.customer.invoice.invoiceNumber"),
101
+ name: "number",
102
+ options: {
103
+ customBodyRenderLite: (_, index) => {
104
+ const invoice = data?.list[index];
105
+ const link = getInvoiceLink(invoice, action);
106
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)("a", {
107
+ href: link.url,
108
+ target: link.external ? "_blank" : target,
109
+ rel: "noreferrer",
110
+ children: invoice?.number
111
+ });
112
+ }
113
+ }
114
+ }, {
115
+ label: t("common.amount"),
116
+ name: "total",
117
+ options: {
118
+ customBodyRenderLite: (_, index) => {
119
+ const invoice = data?.list[index];
120
+ const link = getInvoiceLink(invoice, action);
121
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)("a", {
122
+ href: link.url,
123
+ target: link.external ? "_blank" : target,
124
+ rel: "noreferrer",
125
+ children: /* @__PURE__ */(0, _jsxRuntime.jsxs)(_material.Typography, {
126
+ children: [(0, _util.formatBNStr)(invoice.total, invoice.paymentCurrency.decimal), "\xA0", invoice.paymentCurrency.symbol]
127
+ })
128
+ });
129
+ }
130
+ }
131
+ }, {
132
+ label: t("common.updatedAt"),
133
+ name: "name",
134
+ options: {
135
+ customBodyRenderLite: (val, index) => {
136
+ const invoice = data?.list[index];
137
+ const link = getInvoiceLink(invoice, action);
138
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)("a", {
139
+ href: link.url,
140
+ target: link.external ? "_blank" : target,
141
+ rel: "noreferrer",
142
+ children: (0, _util.formatToDate)(invoice.created_at, locale, "YYYY-MM-DD HH:mm:ss")
143
+ });
144
+ }
145
+ }
146
+ }, {
147
+ label: t("common.description"),
148
+ name: "",
149
+ options: {
150
+ sort: false,
151
+ customBodyRenderLite: (val, index) => {
152
+ const invoice = data?.list[index];
153
+ const link = getInvoiceLink(invoice, action);
154
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)("a", {
155
+ href: link.url,
156
+ target: link.external ? "_blank" : target,
157
+ rel: "noreferrer",
158
+ children: invoice.description || invoice.id
159
+ });
160
+ }
161
+ }
162
+ }, {
163
+ label: t("common.status"),
164
+ name: "created_at",
165
+ options: {
166
+ sort: true,
167
+ customBodyRenderLite: (val, index) => {
168
+ const invoice = data?.list[index];
169
+ const link = getInvoiceLink(invoice, action);
170
+ if (action) {
171
+ return link.connect ? /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
172
+ variant: "text",
173
+ size: "small",
174
+ onClick: () => onPay(invoice.id),
175
+ sx: {
176
+ color: "text.link"
177
+ },
178
+ children: t("payment.customer.invoice.pay")
179
+ }) : /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
180
+ component: "a",
181
+ variant: "text",
182
+ size: "small",
183
+ href: link.url,
184
+ target: link.external ? "_blank" : target,
185
+ sx: {
186
+ color: "var(--foregrounds-fg-interactive, #0086FF) !important"
187
+ },
188
+ rel: "noreferrer",
189
+ children: t("payment.customer.invoice.pay")
190
+ });
191
+ }
192
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)("a", {
193
+ href: link.url,
194
+ target: link.external ? "_blank" : target,
195
+ rel: "noreferrer",
196
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_status.default, {
197
+ label: invoice.status,
198
+ color: (0, _util.getInvoiceStatusColor)(invoice.status)
199
+ })
200
+ });
201
+ }
202
+ }
203
+ }];
204
+ const onTableChange = ({
205
+ page,
206
+ rowsPerPage
207
+ }) => {
208
+ if (search.pageSize !== rowsPerPage) {
209
+ setSearch(x => ({
210
+ ...x,
211
+ pageSize: rowsPerPage,
212
+ page: 1
213
+ }));
214
+ } else if (search.page !== page + 1) {
215
+ setSearch(x => ({
216
+ ...x,
217
+ page: page + 1
218
+ }));
219
+ }
220
+ };
221
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(InvoiceTableRoot, {
222
+ children: /* @__PURE__ */(0, _jsxRuntime.jsx)(_table.default, {
223
+ hasRowLink: true,
224
+ durable: `__${listKey}__`,
225
+ durableKeys: ["page", "rowsPerPage", "searchText"],
226
+ data: data.list,
227
+ columns,
228
+ options: {
229
+ count: data.count,
230
+ page: search.page - 1,
231
+ rowsPerPage: search.pageSize
232
+ },
233
+ loading,
234
+ onChange: onTableChange,
235
+ toolbar: false,
236
+ sx: {
237
+ mt: 2
238
+ },
239
+ showMobile: false,
240
+ mobileTDFlexDirection: "row",
241
+ emptyNodeText: t("payment.customer.invoice.emptyList")
242
+ })
243
+ });
244
+ });
245
+ const InvoiceTableRoot = (0, _system.styled)(_material.Box)`
246
+ @media (max-width: ${({
247
+ theme
248
+ }) => theme.breakpoints.values.md}px) {
249
+ .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > td.MuiTableCell-root {
250
+ > div {
251
+ width: fit-content;
252
+ flex: inherit;
253
+ font-size: 14px;
254
+ }
255
+ }
256
+ .invoice-summary {
257
+ padding-right: 20px;
258
+ }
259
+ }
260
+ `;
261
+ const InvoiceList = _react.default.memo(props => {
262
+ const {
263
+ customer_id,
264
+ subscription_id,
265
+ include_recovered_from,
266
+ currency_id,
267
+ include_staking,
268
+ status,
269
+ pageSize,
270
+ target,
271
+ action,
272
+ onPay
273
+ } = props;
274
+ const size = pageSize || 10;
275
+ const subscription = (0, _subscription.useSubscription)("events");
276
+ const {
277
+ t,
278
+ locale
279
+ } = (0, _context.useLocaleContext)();
78
280
  const {
79
281
  data,
80
282
  loadMore,
@@ -91,10 +293,11 @@ function CustomerInvoiceList({
91
293
  currency_id,
92
294
  subscription_id,
93
295
  include_staking,
296
+ include_recovered_from,
94
297
  ignore_zero: true
95
298
  });
96
299
  }, {
97
- reloadDeps: [customer_id, subscription_id, status, include_staking]
300
+ reloadDeps: [customer_id, subscription_id, status, include_staking, include_recovered_from]
98
301
  });
99
302
  (0, _react.useEffect)(() => {
100
303
  if (subscription && customer_id) {
@@ -107,47 +310,6 @@ function CustomerInvoiceList({
107
310
  });
108
311
  }
109
312
  }, [subscription]);
110
- const onPay = invoiceId => {
111
- if (state.paying) {
112
- return;
113
- }
114
- setState({
115
- paying: invoiceId
116
- });
117
- connect.open({
118
- action: "collect",
119
- saveConnect: false,
120
- messages: {
121
- scan: "",
122
- title: t(`payment.customer.invoice.${action || "pay"}`),
123
- success: t(`payment.customer.invoice.${action || "pay"}Success`),
124
- error: t(`payment.customer.invoice.${action || "pay"}Error`),
125
- confirm: ""
126
- },
127
- extraParams: {
128
- invoiceId,
129
- action
130
- },
131
- onSuccess: () => {
132
- connect.close();
133
- setState({
134
- paying: ""
135
- });
136
- },
137
- onClose: () => {
138
- connect.close();
139
- setState({
140
- paying: ""
141
- });
142
- },
143
- onError: err => {
144
- setState({
145
- paying: ""
146
- });
147
- _Toast.default.error((0, _util.formatError)(err));
148
- }
149
- });
150
- };
151
313
  if (loading || !data) {
152
314
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.CircularProgress, {});
153
315
  }
@@ -260,7 +422,6 @@ function CustomerInvoiceList({
260
422
  }) : /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Button, {
261
423
  component: "a",
262
424
  variant: "contained",
263
- color: "primary",
264
425
  size: "small",
265
426
  href: link.url,
266
427
  target: link.external ? "_blank" : target,
@@ -293,19 +454,89 @@ function CustomerInvoiceList({
293
454
  })]
294
455
  })]
295
456
  });
457
+ });
458
+ function CustomerInvoiceList(props) {
459
+ const {
460
+ action,
461
+ type
462
+ } = props;
463
+ const {
464
+ t
465
+ } = (0, _context.useLocaleContext)();
466
+ const {
467
+ connect
468
+ } = (0, _payment.usePaymentContext)();
469
+ const [state, setState] = (0, _ahooks.useSetState)({
470
+ paying: ""
471
+ });
472
+ const onPay = invoiceId => {
473
+ if (state.paying) {
474
+ return;
475
+ }
476
+ setState({
477
+ paying: invoiceId
478
+ });
479
+ connect.open({
480
+ action: "collect",
481
+ saveConnect: false,
482
+ messages: {
483
+ scan: "",
484
+ title: t(`payment.customer.invoice.${action || "pay"}`),
485
+ success: t(`payment.customer.invoice.${action || "pay"}Success`),
486
+ error: t(`payment.customer.invoice.${action || "pay"}Error`),
487
+ confirm: ""
488
+ },
489
+ extraParams: {
490
+ invoiceId,
491
+ action
492
+ },
493
+ onSuccess: () => {
494
+ connect.close();
495
+ setState({
496
+ paying: ""
497
+ });
498
+ },
499
+ onClose: () => {
500
+ connect.close();
501
+ setState({
502
+ paying: ""
503
+ });
504
+ },
505
+ onError: err => {
506
+ setState({
507
+ paying: ""
508
+ });
509
+ _Toast.default.error((0, _util.formatError)(err));
510
+ }
511
+ });
512
+ };
513
+ if (type === "table") {
514
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(InvoiceTable, {
515
+ ...props,
516
+ onPay
517
+ });
518
+ }
519
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(InvoiceList, {
520
+ ...props,
521
+ onPay
522
+ });
296
523
  }
297
524
  CustomerInvoiceList.defaultProps = {
298
525
  customer_id: "",
299
526
  subscription_id: "",
300
527
  currency_id: "",
301
528
  include_staking: false,
529
+ include_recovered_from: false,
302
530
  status: "open,paid,uncollectible",
303
531
  pageSize: 10,
304
532
  target: "_self",
305
- action: ""
533
+ action: "",
534
+ type: "list"
306
535
  };
307
536
  const Root = (0, _system.styled)(_material.Stack)`
308
- @media (max-width: 600px) {
537
+ @media (max-width: ${({
538
+ theme
539
+ }) => theme.breakpoints.values.md}px) {
309
540
  .invoice-description {
310
541
  display: none !important;
311
542
  }
@@ -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,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useMobile = useMobile;
7
+ var _styles = require("@mui/material/styles");
8
+ var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ const MOBILE_POINT = "md";
11
+ function useMobile(mobilePoint = MOBILE_POINT) {
12
+ const theme = (0, _styles.useTheme)();
13
+ return {
14
+ isMobile: (0, _useMediaQuery.default)(theme.breakpoints.down(mobilePoint)),
15
+ mobileSize: `${theme.breakpoints.values[mobilePoint]}px`
16
+ };
17
+ }
package/lib/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/lib/index.js CHANGED
@@ -13,6 +13,7 @@ var _exportNames = {
13
13
  FormInput: true,
14
14
  Livemode: true,
15
15
  PricingTable: true,
16
+ Table: true,
16
17
  SafeGuard: true,
17
18
  Status: true,
18
19
  Switch: true,
@@ -29,6 +30,8 @@ var _exportNames = {
29
30
  ProductSkeleton: true,
30
31
  PaymentSummary: true,
31
32
  PricingItem: true,
33
+ CountrySelect: true,
34
+ PaymentThemeProvider: true,
32
35
  translations: true,
33
36
  createTranslator: true
34
37
  };
@@ -68,6 +71,12 @@ Object.defineProperty(exports, "ConfirmDialog", {
68
71
  return _confirm.default;
69
72
  }
70
73
  });
74
+ Object.defineProperty(exports, "CountrySelect", {
75
+ enumerable: true,
76
+ get: function () {
77
+ return _countrySelect.default;
78
+ }
79
+ });
71
80
  Object.defineProperty(exports, "CurrencySelector", {
72
81
  enumerable: true,
73
82
  get: function () {
@@ -110,6 +119,12 @@ Object.defineProperty(exports, "PaymentSummary", {
110
119
  return _summary.default;
111
120
  }
112
121
  });
122
+ Object.defineProperty(exports, "PaymentThemeProvider", {
123
+ enumerable: true,
124
+ get: function () {
125
+ return _theme.PaymentThemeProvider;
126
+ }
127
+ });
113
128
  Object.defineProperty(exports, "PhoneInput", {
114
129
  enumerable: true,
115
130
  get: function () {
@@ -158,6 +173,12 @@ Object.defineProperty(exports, "Switch", {
158
173
  return _switchButton.default;
159
174
  }
160
175
  });
176
+ Object.defineProperty(exports, "Table", {
177
+ enumerable: true,
178
+ get: function () {
179
+ return _table2.default;
180
+ }
181
+ });
161
182
  Object.defineProperty(exports, "TxGas", {
162
183
  enumerable: true,
163
184
  get: function () {
@@ -203,6 +224,7 @@ var _confirm = _interopRequireDefault(require("./components/confirm"));
203
224
  var _input = _interopRequireDefault(require("./components/input"));
204
225
  var _livemode = _interopRequireDefault(require("./components/livemode"));
205
226
  var _pricingTable = _interopRequireDefault(require("./components/pricing-table"));
227
+ var _table2 = _interopRequireDefault(require("./components/table"));
206
228
  var _safeGuard = _interopRequireDefault(require("./components/safe-guard"));
207
229
  var _status = _interopRequireDefault(require("./components/status"));
208
230
  var _switchButton = _interopRequireDefault(require("./components/switch-button"));
@@ -219,6 +241,8 @@ var _index = _interopRequireDefault(require("./payment/index"));
219
241
  var _productSkeleton = _interopRequireDefault(require("./payment/product-skeleton"));
220
242
  var _summary = _interopRequireDefault(require("./payment/summary"));
221
243
  var _pricingItem = _interopRequireDefault(require("./components/pricing-item"));
244
+ var _countrySelect = _interopRequireDefault(require("./components/country-select"));
245
+ var _theme = require("./theme");
222
246
  var _util = require("./libs/util");
223
247
  Object.keys(_util).forEach(function (key) {
224
248
  if (key === "default" || key === "__esModule") return;
@@ -267,5 +291,17 @@ Object.keys(_subscription).forEach(function (key) {
267
291
  }
268
292
  });
269
293
  });
294
+ var _mobile = require("./hooks/mobile");
295
+ Object.keys(_mobile).forEach(function (key) {
296
+ if (key === "default" || key === "__esModule") return;
297
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
298
+ if (key in exports && exports[key] === _mobile[key]) return;
299
+ Object.defineProperty(exports, key, {
300
+ enumerable: true,
301
+ get: function () {
302
+ return _mobile[key];
303
+ }
304
+ });
305
+ });
270
306
  var _locales = require("./locales");
271
307
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -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;