@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
@@ -3,20 +3,13 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.FormInputError = FormInputError;
7
- module.exports = FormInput;
6
+
8
7
  var _jsxRuntime = require("react/jsx-runtime");
8
+ var _react = require("react");
9
9
  var _material = require("@mui/material");
10
10
  var _get = _interopRequireDefault(require("lodash/get"));
11
11
  var _reactHookForm = require("react-hook-form");
12
12
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
- FormInput.defaultProps = {
14
- label: "",
15
- placeholder: "",
16
- errorPosition: "bottom",
17
- rules: {},
18
- wrapperStyle: {}
19
- };
20
13
  function FormInputError({
21
14
  error
22
15
  }) {
@@ -29,7 +22,7 @@ function FormInputError({
29
22
  })
30
23
  });
31
24
  }
32
- function FormInput({
25
+ const FormInput = (0, _react.forwardRef)(({
33
26
  name,
34
27
  label,
35
28
  placeholder,
@@ -37,11 +30,15 @@ function FormInput({
37
30
  errorPosition,
38
31
  wrapperStyle,
39
32
  ...rest
40
- }) {
33
+ }, ref) => {
41
34
  const {
42
35
  control,
43
36
  formState
44
37
  } = (0, _reactHookForm.useFormContext)();
38
+ const inputRef = (0, _react.useRef)(null);
39
+ (0, _react.useImperativeHandle)(ref, () => {
40
+ return inputRef.current;
41
+ });
45
42
  const error = (0, _get.default)(formState.errors, name)?.message;
46
43
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_reactHookForm.Controller, {
47
44
  name,
@@ -55,6 +52,9 @@ function FormInput({
55
52
  ...wrapperStyle
56
53
  },
57
54
  children: [!!label && /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.FormLabel, {
55
+ sx: {
56
+ color: "text.primary"
57
+ },
58
58
  children: label
59
59
  }), /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.TextField, {
60
60
  fullWidth: true,
@@ -64,6 +64,7 @@ function FormInput({
64
64
  size: "small",
65
65
  ...field,
66
66
  ...rest,
67
+ inputRef,
67
68
  InputProps: Object.assign(rest.InputProps || {}, errorPosition === "right" && error ? {
68
69
  endAdornment: /* @__PURE__ */(0, _jsxRuntime.jsx)(FormInputError, {
69
70
  error
@@ -72,4 +73,12 @@ function FormInput({
72
73
  })]
73
74
  })
74
75
  });
75
- }
76
+ });
77
+ FormInput.defaultProps = {
78
+ label: "",
79
+ placeholder: "",
80
+ errorPosition: "bottom",
81
+ rules: {},
82
+ wrapperStyle: {}
83
+ };
84
+ module.exports = FormInput;
@@ -18,6 +18,7 @@ function Livemode({
18
18
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Chip, {
19
19
  label: t("common.livemode"),
20
20
  size: "small",
21
+ color: "warning",
21
22
  sx: {
22
23
  ml: 2,
23
24
  height: 18,
@@ -266,7 +266,6 @@ function PricingTable({
266
266
  color: "text.primary",
267
267
  fontWeight: 600,
268
268
  sx: {
269
- color: "#4B5563",
270
269
  fontSize: "18px !important",
271
270
  fontWeight: "600"
272
271
  },
@@ -293,7 +292,6 @@ function PricingTable({
293
292
  color: "text.secondary",
294
293
  sx: {
295
294
  marginTop: "0px !important",
296
- color: "#4b5563",
297
295
  fontWeight: "400",
298
296
  fontSize: "16px",
299
297
  textAlign: "left"
@@ -9,14 +9,13 @@ var _material = require("@mui/material");
9
9
  function Status(props) {
10
10
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Chip, {
11
11
  size: "small",
12
- variant: "outlined",
12
+ variant: "filled",
13
13
  ...props,
14
14
  sx: {
15
15
  ...(props.sx || {}),
16
16
  borderRadius: "4px",
17
17
  height: 20,
18
- textTransform: "capitalize",
19
- marginRight: "10px"
18
+ textTransform: "capitalize"
20
19
  }
21
20
  });
22
21
  }
@@ -0,0 +1,2 @@
1
+ declare const Table: any;
2
+ export default Table;
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _jsxRuntime = require("react/jsx-runtime");
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _Empty = _interopRequireDefault(require("@arcblock/ux/lib/Empty"));
10
+ var _Datatable = _interopRequireDefault(require("@arcblock/ux/lib/Datatable"));
11
+ var _context = require("@arcblock/ux/lib/Locale/context");
12
+ var _system = require("@mui/system");
13
+ var _mobile = require("../hooks/mobile");
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+ function EmptyStub() {
16
+ return null;
17
+ }
18
+ const Table = _react.default.memo(({
19
+ options,
20
+ columns,
21
+ toolbar = true,
22
+ footer = true,
23
+ hasRowLink = false,
24
+ emptyNodeText = "",
25
+ ...rest
26
+ }) => {
27
+ const {
28
+ locale,
29
+ t
30
+ } = (0, _context.useLocaleContext)();
31
+ const {
32
+ isMobile
33
+ } = (0, _mobile.useMobile)();
34
+ const defaultOptions = {
35
+ print: false,
36
+ download: false,
37
+ filter: false,
38
+ selectableRows: "none",
39
+ rowsPerPage: 10,
40
+ rowsPerPageOptions: [10, 20, 50, 100],
41
+ searchDebounceTime: 300,
42
+ tableBodyHeight: "100%",
43
+ loading: true
44
+ };
45
+ const components = {};
46
+ if (!toolbar) {
47
+ components.TableToolbar = EmptyStub;
48
+ }
49
+ if (!footer) {
50
+ components.TableFooter = EmptyStub;
51
+ }
52
+ return /* @__PURE__ */(0, _jsxRuntime.jsx)(Wrapped, {
53
+ locale,
54
+ options: {
55
+ ...defaultOptions,
56
+ ...options
57
+ },
58
+ columns: columns.map(x => {
59
+ x.options = x.options || {};
60
+ x.options.filter = x.options.filter || false;
61
+ x.options.sort = x.options.sort || false;
62
+ return x;
63
+ }),
64
+ emptyNode: /* @__PURE__ */(0, _jsxRuntime.jsx)(_Empty.default, {
65
+ children: emptyNodeText || t("empty.records")
66
+ }),
67
+ ...rest,
68
+ components,
69
+ hasRowLink,
70
+ isMobile
71
+ });
72
+ });
73
+ const Wrapped = (0, _system.styled)(_Datatable.default)`
74
+ ${props => props.hasRowLink ? `.MuiTableCell-root {
75
+ font-size: 1rem !important;
76
+ }` : ""}
77
+ .MuiPaper-root {
78
+ border-radius: 8px;
79
+ overflow: hidden;
80
+ }
81
+ table.MuiTable-root {
82
+ outline: 1px solid var(--stroke-border-base, #eff1f5);
83
+ border-radius: var(--radius-m, 8px);
84
+ overflow: hidden;
85
+ }
86
+ [class*='MUIDataTable-responsiveBase'] {
87
+ outline: 1px solid var(--stroke-border-base, #eff1f5);
88
+ border-radius: var(--radius-m, 8px);
89
+ }
90
+
91
+ th.MuiTableCell-head {
92
+ padding: 8px 16px 8px 16px;
93
+ text-transform: inherit;
94
+ background: var(--backgrounds-bg-subtle, #f9fafb);
95
+ border-bottom: none;
96
+ &:first-of-type {
97
+ border-top-left-radius: 8px;
98
+ padding-left: 20px;
99
+ }
100
+ &:last-of-type {
101
+ border-top-right-radius: 8px;
102
+ }
103
+ }
104
+
105
+ tr.MuiTableRow-root:not(.MuiTableRow-footer):hover {
106
+ background: #f5f5f5;
107
+ }
108
+ tr.MuiTableRow-root:last-of-type td:first-of-type {
109
+ border-bottom-left-radius: 8px;
110
+ }
111
+
112
+ tr.MuiTableRow-root:last-of-type td:last-of-type {
113
+ border-bottom-right-radius: 8px;
114
+ }
115
+
116
+ tr.MuiTableRow-root:nth-of-type(even) {
117
+ background: var(--backgrounds-bg-subtle, #f9fafb);
118
+ }
119
+ td.MuiTableCell-root {
120
+ border-bottom: none;
121
+ &:first-of-type {
122
+ padding-left: 20px;
123
+ }
124
+ &.MuiTableCell-footer {
125
+ border: none;
126
+ }
127
+ }
128
+
129
+ .datatable-footer {
130
+ .MuiTableRow-root.MuiTableRow-footer {
131
+ border: none;
132
+ }
133
+ table.MuiTable-root {
134
+ outline: none;
135
+ overflow: hidden;
136
+ }
137
+ .MuiTablePagination-input {
138
+ background: none;
139
+ }
140
+ div.MuiSelect-select {
141
+ padding: 0 24px 0 0;
142
+ }
143
+ }
144
+
145
+ th a,
146
+ td a {
147
+ text-decoration: none;
148
+ display: block;
149
+ color: inherit;
150
+ &:first-of-type {
151
+ padding-left: 0;
152
+ }
153
+ }
154
+
155
+ > div {
156
+ overflow: auto;
157
+ }
158
+ @media (max-width: ${({
159
+ theme
160
+ }) => theme.breakpoints.values.md}px) {
161
+ th a,
162
+ td a {
163
+ text-decoration: none;
164
+ display: block;
165
+ color: inherit;
166
+ padding-top: 0;
167
+ padding-bottom: 0;
168
+ padding-right: 0;
169
+ }
170
+ tr.MuiTableRow-root {
171
+ border: none;
172
+ padding: 20px;
173
+ display: block;
174
+ }
175
+ td.MuiTableCell-root:first-of-type {
176
+ padding-left: 0;
177
+ margin-top: 0;
178
+ }
179
+ td.MuiTableCell-root {
180
+ margin: 0;
181
+ margin-top: 8px;
182
+ align-items: center;
183
+ padding: 0;
184
+ flex-wrap: wrap;
185
+ flex-direction: ${({
186
+ mobileTDFlexDirection = "column"
187
+ }) => mobileTDFlexDirection || "row"};
188
+ align-items: ${({
189
+ mobileTDFlexDirection = "column"
190
+ }) => mobileTDFlexDirection === "column" ? "flex-start" : "center"};
191
+ justify-content: ${({
192
+ mobileTDFlexDirection = "column"
193
+ }) => mobileTDFlexDirection === "column" ? "flex-start" : "space-between"};
194
+ }
195
+ td.MuiTableCell-root > div {
196
+ margin-bottom: 4px;
197
+ }
198
+ .MuiTable-root > .MuiTableBody-root > .MuiTableRow-root > td.MuiTableCell-root {
199
+ display: flex;
200
+ flex-direction: ${({
201
+ mobileTDFlexDirection = "column"
202
+ }) => mobileTDFlexDirection || "row"};
203
+ align-items: flex-start;
204
+ justify-content: ${({
205
+ mobileTDFlexDirection = "column"
206
+ }) => mobileTDFlexDirection === "row" ? "space-between" : "flex-start"};
207
+ flex-wrap: ${({
208
+ mobileTDFlexDirection = "column"
209
+ }) => mobileTDFlexDirection === "row" ? "nowrap" : "wrap"};
210
+ word-break: break-all;
211
+ &.datatables-noprint {
212
+ justify-content: center;
213
+ }
214
+ }
215
+ [class*='MUIDataTable-responsiveBase'] tr:not([class*='responsiveSimple']) td.MuiTableCell-body > div {
216
+ width: inherit;
217
+ }
218
+ }
219
+ `;
220
+ module.exports = Table;
@@ -18,6 +18,8 @@ export type PaymentContextType = {
18
18
  getMethod: (methodId: string) => TPaymentMethodExpanded | undefined;
19
19
  setLivemode: (livemode: boolean) => void;
20
20
  api: Axios;
21
+ payable: boolean;
22
+ setPayable: (status: boolean) => void;
21
23
  };
22
24
  export type PaymentContextProps = {
23
25
  session: import('@arcblock/did-connect/lib/types').SessionContext['session'];
@@ -54,6 +54,7 @@ function PaymentProvider({
54
54
  defaultValue: true
55
55
  });
56
56
  const prefix = (0, _util.getPrefix)();
57
+ const [payable, setPayable] = (0, _react.useState)(true);
57
58
  if (error) {
58
59
  return /* @__PURE__ */(0, _jsxRuntime.jsx)(_material.Alert, {
59
60
  severity: "error",
@@ -74,7 +75,9 @@ function PaymentProvider({
74
75
  getMethod: methodId => getMethod(methodId, data.paymentMethods),
75
76
  refresh: run,
76
77
  setLivemode,
77
- api: _api.default
78
+ api: _api.default,
79
+ payable,
80
+ setPayable
78
81
  },
79
82
  children
80
83
  });
@@ -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;