@stokr/components-library 2.3.63-beta.2 → 2.3.65-beta.1
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.
- package/dist/components/InfoIcon/InfoIcon.js +22 -49
- package/dist/components/InfoIcon/InfoIcon.styles.js +3 -3
- package/dist/components/LearnMorePage/LearnMoreExampleObject.js +7 -7
- package/dist/components/Payment/PaymentDisplay.js +176 -0
- package/dist/components/Payment/PaymentDisplay.stories.js +302 -0
- package/dist/components/Payment/TimerComponent.js +80 -0
- package/dist/components/Payment/TimerComponent.stories.js +236 -0
- package/dist/components/Timeline/Timeline.js +51 -0
- package/dist/components/Timeline/Timeline.stories.js +393 -0
- package/dist/components/Timeline/Timeline.styles.js +74 -0
- package/dist/components/Timeline/TimelineStep.js +88 -0
- package/dist/components/Timeline/index.js +19 -0
- package/dist/components/TransactionDetails/TransactionDetailsTable.js +64 -0
- package/dist/components/TransactionDetails/TransactionDetailsTable.stories.js +305 -0
- package/dist/context/Checkbox/CheckboxContext.js +81 -7
- package/dist/index.js +44 -77
- package/dist/static/images/bitcoin-logo.svg +9 -0
- package/dist/static/images/check-icon.svg +3 -0
- package/dist/static/images/cross-icon.svg +3 -0
- package/dist/static/images/usdc-logo.svg +5 -0
- package/dist/static/images/usdq-logo.png +0 -0
- package/package.json +1 -5
- package/dist/static/images/1.svg +0 -4
- package/dist/static/images/2.svg +0 -4
- package/dist/static/images/3.svg +0 -3
- package/dist/static/images/4.svg +0 -3
- package/dist/static/images/amazon-logo.png +0 -0
- package/dist/static/images/avatar-cog.png +0 -0
- package/dist/static/images/avatar.png +0 -0
- package/dist/static/images/camera.svg +0 -1
- package/dist/static/images/document-back.svg +0 -1
- package/dist/static/images/document-small.svg +0 -1
- package/dist/static/images/document.svg +0 -1
- package/dist/static/images/favicon.png +0 -0
- package/dist/static/images/hdd.png +0 -0
- package/dist/static/images/lemonway.png +0 -0
- package/dist/static/images/member-item-picture.png +0 -0
- package/dist/static/images/nav_green.svg +0 -31
- package/dist/static/images/one.jpg +0 -0
- package/dist/static/images/passport.svg +0 -1
- package/dist/static/images/profile-picture-placeholder.png +0 -0
- package/dist/static/images/profile-picture-placeholder.svg +0 -1
- package/dist/static/images/profile-picture.png +0 -0
- package/dist/static/images/shark.jpg +0 -0
- package/dist/static/images/three.jpg +0 -0
- package/dist/static/images/two-sided-document.svg +0 -26
- package/dist/static/images/two.jpg +0 -0
- package/dist/static/images/user-profile.png +0 -0
- package/dist/static/images/whales.png +0 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.WithoutBorders = exports.WithIcons = exports.WithCustomStyling = exports.WithContainerStyling = exports.SingleRow = exports.MultipleRows = exports.LongTextContent = exports.EmptyState = exports.CustomWidth = exports.ComplexExample = exports.Basic = void 0;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _TransactionDetailsTable = require("./TransactionDetailsTable");
|
|
9
|
+
var _ComponentWrapper = require("../ComponentWrapper/ComponentWrapper.styles");
|
|
10
|
+
var _global = _interopRequireDefault(require("../../styles/global"));
|
|
11
|
+
var _InfoIcon = require("../InfoIcon/InfoIcon");
|
|
12
|
+
var _Info = require("../icons/Info");
|
|
13
|
+
var _colors = _interopRequireDefault(require("../../styles/colors"));
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
15
|
+
var _default = exports.default = {
|
|
16
|
+
title: 'Components Library/TransactionDetails/TransactionDetailsTable',
|
|
17
|
+
component: _TransactionDetailsTable.TransactionDetailsTable,
|
|
18
|
+
argTypes: {
|
|
19
|
+
data: {
|
|
20
|
+
control: 'object',
|
|
21
|
+
description: 'Array of objects with label, value, labelIcon, and valueIcon properties'
|
|
22
|
+
},
|
|
23
|
+
showBorders: {
|
|
24
|
+
control: 'boolean',
|
|
25
|
+
description: 'Show borders around the table and rows',
|
|
26
|
+
defaultValue: true
|
|
27
|
+
},
|
|
28
|
+
maxWidth: {
|
|
29
|
+
control: 'text',
|
|
30
|
+
description: 'Maximum width of the table container'
|
|
31
|
+
},
|
|
32
|
+
labelCellStyle: {
|
|
33
|
+
control: false,
|
|
34
|
+
description: 'Function that returns style object for label cells: (index, item) => style'
|
|
35
|
+
},
|
|
36
|
+
valueCellStyle: {
|
|
37
|
+
control: false,
|
|
38
|
+
description: 'Function that returns style object for value cells: (index, item) => style'
|
|
39
|
+
},
|
|
40
|
+
rowStyle: {
|
|
41
|
+
control: false,
|
|
42
|
+
description: 'Function that returns style object for rows: (index, item) => style'
|
|
43
|
+
},
|
|
44
|
+
containerStyle: {
|
|
45
|
+
control: 'object',
|
|
46
|
+
description: 'Style object for the table container'
|
|
47
|
+
},
|
|
48
|
+
className: {
|
|
49
|
+
control: 'text',
|
|
50
|
+
description: 'CSS class name for the table container'
|
|
51
|
+
},
|
|
52
|
+
labelCellClassName: {
|
|
53
|
+
control: false,
|
|
54
|
+
description: 'Function that returns className for label cells: (index, item) => className'
|
|
55
|
+
},
|
|
56
|
+
valueCellClassName: {
|
|
57
|
+
control: false,
|
|
58
|
+
description: 'Function that returns className for value cells: (index, item) => className'
|
|
59
|
+
},
|
|
60
|
+
rowClassName: {
|
|
61
|
+
control: false,
|
|
62
|
+
description: 'Function that returns className for rows: (index, item) => className'
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
decorators: [Story => /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_global.default, null), /*#__PURE__*/_react.default.createElement(_ComponentWrapper.ComponentWrapper, null, /*#__PURE__*/_react.default.createElement(Story, null)))]
|
|
66
|
+
};
|
|
67
|
+
const Template = args => /*#__PURE__*/_react.default.createElement(_TransactionDetailsTable.TransactionDetailsTable, args);
|
|
68
|
+
|
|
69
|
+
// Basic example
|
|
70
|
+
const Basic = exports.Basic = Template.bind({});
|
|
71
|
+
Basic.args = {
|
|
72
|
+
data: [{
|
|
73
|
+
label: 'Transaction ID',
|
|
74
|
+
value: '0x1234...5678'
|
|
75
|
+
}, {
|
|
76
|
+
label: 'Amount',
|
|
77
|
+
value: '1,000.00 EUR'
|
|
78
|
+
}, {
|
|
79
|
+
label: 'Status',
|
|
80
|
+
value: 'Completed'
|
|
81
|
+
}]
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// Multiple rows
|
|
85
|
+
const MultipleRows = exports.MultipleRows = Template.bind({});
|
|
86
|
+
MultipleRows.args = {
|
|
87
|
+
data: [{
|
|
88
|
+
label: 'Transaction ID',
|
|
89
|
+
value: '0x1234567890abcdef'
|
|
90
|
+
}, {
|
|
91
|
+
label: 'From Address',
|
|
92
|
+
value: '0xabcd...ef01'
|
|
93
|
+
}, {
|
|
94
|
+
label: 'To Address',
|
|
95
|
+
value: '0x2345...6789'
|
|
96
|
+
}, {
|
|
97
|
+
label: 'Amount',
|
|
98
|
+
value: '5,000.00 EUR'
|
|
99
|
+
}, {
|
|
100
|
+
label: 'Gas Fee',
|
|
101
|
+
value: '0.001 ETH'
|
|
102
|
+
}, {
|
|
103
|
+
label: 'Status',
|
|
104
|
+
value: 'Completed'
|
|
105
|
+
}, {
|
|
106
|
+
label: 'Date',
|
|
107
|
+
value: '2024-01-15 14:30:00'
|
|
108
|
+
}]
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
// With icons
|
|
112
|
+
const WithIcons = exports.WithIcons = Template.bind({});
|
|
113
|
+
WithIcons.args = {
|
|
114
|
+
data: [{
|
|
115
|
+
label: 'Transaction ID',
|
|
116
|
+
value: '0x1234...5678',
|
|
117
|
+
labelIcon: /*#__PURE__*/_react.default.createElement(_InfoIcon.InfoIcon, {
|
|
118
|
+
title: "This is the unique identifier for your transaction",
|
|
119
|
+
position: "right"
|
|
120
|
+
})
|
|
121
|
+
}, {
|
|
122
|
+
label: 'Amount',
|
|
123
|
+
value: '1,000.00 EUR',
|
|
124
|
+
valueIcon: /*#__PURE__*/_react.default.createElement(_Info.Info, {
|
|
125
|
+
style: {
|
|
126
|
+
marginRight: '8px',
|
|
127
|
+
display: 'inline-block'
|
|
128
|
+
}
|
|
129
|
+
})
|
|
130
|
+
}, {
|
|
131
|
+
label: 'Status',
|
|
132
|
+
value: 'Completed'
|
|
133
|
+
}]
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// Without borders
|
|
137
|
+
const WithoutBorders = exports.WithoutBorders = Template.bind({});
|
|
138
|
+
WithoutBorders.args = {
|
|
139
|
+
data: [{
|
|
140
|
+
label: 'Transaction ID',
|
|
141
|
+
value: '0x1234...5678'
|
|
142
|
+
}, {
|
|
143
|
+
label: 'Amount',
|
|
144
|
+
value: '1,000.00 EUR'
|
|
145
|
+
}, {
|
|
146
|
+
label: 'Status',
|
|
147
|
+
value: 'Completed'
|
|
148
|
+
}],
|
|
149
|
+
showBorders: false
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// Custom width
|
|
153
|
+
const CustomWidth = exports.CustomWidth = Template.bind({});
|
|
154
|
+
CustomWidth.args = {
|
|
155
|
+
data: [{
|
|
156
|
+
label: 'Transaction ID',
|
|
157
|
+
value: '0x1234...5678'
|
|
158
|
+
}, {
|
|
159
|
+
label: 'Amount',
|
|
160
|
+
value: '1,000.00 EUR'
|
|
161
|
+
}, {
|
|
162
|
+
label: 'Status',
|
|
163
|
+
value: 'Completed'
|
|
164
|
+
}],
|
|
165
|
+
maxWidth: '800px'
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// With custom styling
|
|
169
|
+
const WithCustomStyling = exports.WithCustomStyling = Template.bind({});
|
|
170
|
+
WithCustomStyling.args = {
|
|
171
|
+
data: [{
|
|
172
|
+
label: 'Transaction ID',
|
|
173
|
+
value: '0x1234...5678'
|
|
174
|
+
}, {
|
|
175
|
+
label: 'Amount',
|
|
176
|
+
value: '1,000.00 EUR'
|
|
177
|
+
}, {
|
|
178
|
+
label: 'Status',
|
|
179
|
+
value: 'Completed'
|
|
180
|
+
}, {
|
|
181
|
+
label: 'Priority',
|
|
182
|
+
value: 'High'
|
|
183
|
+
}],
|
|
184
|
+
rowStyle: (index, item) => {
|
|
185
|
+
if (item.value === 'Completed') {
|
|
186
|
+
return {
|
|
187
|
+
backgroundColor: _colors.default.veryLightGreen
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
if (item.value === 'High') {
|
|
191
|
+
return {
|
|
192
|
+
backgroundColor: _colors.default.lightPeach
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
return {};
|
|
196
|
+
},
|
|
197
|
+
valueCellStyle: (index, item) => {
|
|
198
|
+
if (item.value === 'Completed') {
|
|
199
|
+
return {
|
|
200
|
+
color: _colors.default.freshGreen,
|
|
201
|
+
fontWeight: 'bold'
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
return {};
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
// Long text content
|
|
209
|
+
const LongTextContent = exports.LongTextContent = Template.bind({});
|
|
210
|
+
LongTextContent.args = {
|
|
211
|
+
data: [{
|
|
212
|
+
label: 'Transaction Hash',
|
|
213
|
+
value: '0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef'
|
|
214
|
+
}, {
|
|
215
|
+
label: 'Description',
|
|
216
|
+
value: 'This is a very long description that should wrap properly within the table cell and demonstrate how the component handles word wrapping and text overflow scenarios.'
|
|
217
|
+
}, {
|
|
218
|
+
label: 'Short Label',
|
|
219
|
+
value: 'Short value'
|
|
220
|
+
}]
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
// Empty state (edge case)
|
|
224
|
+
const EmptyState = exports.EmptyState = Template.bind({});
|
|
225
|
+
EmptyState.args = {
|
|
226
|
+
data: []
|
|
227
|
+
};
|
|
228
|
+
|
|
229
|
+
// Single row
|
|
230
|
+
const SingleRow = exports.SingleRow = Template.bind({});
|
|
231
|
+
SingleRow.args = {
|
|
232
|
+
data: [{
|
|
233
|
+
label: 'Total Amount',
|
|
234
|
+
value: '10,000.00 EUR'
|
|
235
|
+
}]
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
// With container styling
|
|
239
|
+
const WithContainerStyling = exports.WithContainerStyling = Template.bind({});
|
|
240
|
+
WithContainerStyling.args = {
|
|
241
|
+
data: [{
|
|
242
|
+
label: 'Transaction ID',
|
|
243
|
+
value: '0x1234...5678'
|
|
244
|
+
}, {
|
|
245
|
+
label: 'Amount',
|
|
246
|
+
value: '1,000.00 EUR'
|
|
247
|
+
}, {
|
|
248
|
+
label: 'Status',
|
|
249
|
+
value: 'Completed'
|
|
250
|
+
}],
|
|
251
|
+
containerStyle: {
|
|
252
|
+
borderRadius: '8px',
|
|
253
|
+
padding: '20px',
|
|
254
|
+
backgroundColor: _colors.default.grey3
|
|
255
|
+
}
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
// Complex example with all features
|
|
259
|
+
const ComplexExample = exports.ComplexExample = Template.bind({});
|
|
260
|
+
ComplexExample.args = {
|
|
261
|
+
data: [{
|
|
262
|
+
label: 'Transaction ID',
|
|
263
|
+
value: '0x1234...5678',
|
|
264
|
+
labelIcon: /*#__PURE__*/_react.default.createElement(_InfoIcon.InfoIcon, {
|
|
265
|
+
title: "Unique transaction identifier",
|
|
266
|
+
position: "right",
|
|
267
|
+
noMarginLeft: true
|
|
268
|
+
})
|
|
269
|
+
}, {
|
|
270
|
+
label: 'Amount',
|
|
271
|
+
value: '5,000.00 EUR',
|
|
272
|
+
valueIcon: /*#__PURE__*/_react.default.createElement(_Info.Info, {
|
|
273
|
+
style: {
|
|
274
|
+
marginRight: '8px',
|
|
275
|
+
display: 'inline-block'
|
|
276
|
+
}
|
|
277
|
+
})
|
|
278
|
+
}, {
|
|
279
|
+
label: 'Status',
|
|
280
|
+
value: 'Pending'
|
|
281
|
+
}, {
|
|
282
|
+
label: 'Gas Fee',
|
|
283
|
+
value: '0.002 ETH'
|
|
284
|
+
}, {
|
|
285
|
+
label: 'Network',
|
|
286
|
+
value: 'Ethereum Mainnet'
|
|
287
|
+
}],
|
|
288
|
+
maxWidth: '700px',
|
|
289
|
+
rowStyle: (index, item) => {
|
|
290
|
+
if (item.value === 'Pending') {
|
|
291
|
+
return {
|
|
292
|
+
backgroundColor: _colors.default.yellowLight
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
return {};
|
|
296
|
+
},
|
|
297
|
+
valueCellStyle: (index, item) => {
|
|
298
|
+
if (item.value === 'Pending') {
|
|
299
|
+
return {
|
|
300
|
+
color: _colors.default.warningOrange
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
return {};
|
|
304
|
+
}
|
|
305
|
+
};
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.useCheckboxes = exports.CheckboxProvider = void 0;
|
|
6
|
+
exports.useCheckboxes = exports.useCheckboxActions = exports.CheckboxProvider = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _fetchDataPublic = _interopRequireDefault(require("../../api/fetchDataPublic"));
|
|
9
|
+
var _fetchData = _interopRequireDefault(require("../../api/fetchData"));
|
|
9
10
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
11
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
11
12
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -20,6 +21,7 @@ const CheckboxProvider = _ref => {
|
|
|
20
21
|
} = _ref;
|
|
21
22
|
const [checkboxes, setCheckboxes] = (0, _react.useState)({});
|
|
22
23
|
const [loadingStates, setLoadingStates] = (0, _react.useState)({});
|
|
24
|
+
const [errorStates, setErrorStates] = (0, _react.useState)({});
|
|
23
25
|
const fetchCheckboxes = async function (key) {
|
|
24
26
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
25
27
|
const {
|
|
@@ -27,13 +29,18 @@ const CheckboxProvider = _ref => {
|
|
|
27
29
|
labels
|
|
28
30
|
} = options;
|
|
29
31
|
|
|
30
|
-
// Don't fetch if already loading or
|
|
31
|
-
if (loadingStates[key] || checkboxes[key]) {
|
|
32
|
+
// Don't fetch if already loading, already fetched, or previously failed
|
|
33
|
+
if (loadingStates[key] || checkboxes[key] !== undefined || errorStates[key]) {
|
|
32
34
|
return;
|
|
33
35
|
}
|
|
34
36
|
setLoadingStates(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
35
37
|
[key]: true
|
|
36
38
|
}));
|
|
39
|
+
setErrorStates(prev => {
|
|
40
|
+
const newState = _objectSpread({}, prev);
|
|
41
|
+
delete newState[key]; // Clear previous error if retrying
|
|
42
|
+
return newState;
|
|
43
|
+
});
|
|
37
44
|
try {
|
|
38
45
|
let response;
|
|
39
46
|
if (group) {
|
|
@@ -54,6 +61,14 @@ const CheckboxProvider = _ref => {
|
|
|
54
61
|
}));
|
|
55
62
|
} catch (error) {
|
|
56
63
|
console.error("Failed to fetch checkboxes for key: ".concat(key), error);
|
|
64
|
+
// Mark as failed to prevent infinite retries
|
|
65
|
+
setErrorStates(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
66
|
+
[key]: error
|
|
67
|
+
}));
|
|
68
|
+
// Set checkboxes to null to indicate fetch was attempted but failed
|
|
69
|
+
setCheckboxes(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
70
|
+
[key]: null
|
|
71
|
+
}));
|
|
57
72
|
} finally {
|
|
58
73
|
setLoadingStates(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
59
74
|
[key]: false
|
|
@@ -62,16 +77,56 @@ const CheckboxProvider = _ref => {
|
|
|
62
77
|
};
|
|
63
78
|
const getCheckboxes = function (key) {
|
|
64
79
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
65
|
-
// Auto-fetch if not already loaded
|
|
66
|
-
if (
|
|
80
|
+
// Auto-fetch if not already loaded, not loading, and not in error state
|
|
81
|
+
if (checkboxes[key] === undefined && !loadingStates[key] && !errorStates[key]) {
|
|
67
82
|
fetchCheckboxes(key, options);
|
|
68
83
|
}
|
|
69
84
|
return {
|
|
70
85
|
checkboxes: checkboxes[key] || null,
|
|
71
86
|
isLoading: loadingStates[key] || false,
|
|
72
|
-
|
|
87
|
+
error: errorStates[key] || null,
|
|
88
|
+
refetch: () => {
|
|
89
|
+
// Clear error state to allow retry
|
|
90
|
+
setErrorStates(prev => {
|
|
91
|
+
const newState = _objectSpread({}, prev);
|
|
92
|
+
delete newState[key];
|
|
93
|
+
return newState;
|
|
94
|
+
});
|
|
95
|
+
setCheckboxes(prev => {
|
|
96
|
+
const newState = _objectSpread({}, prev);
|
|
97
|
+
delete newState[key];
|
|
98
|
+
return newState;
|
|
99
|
+
});
|
|
100
|
+
fetchCheckboxes(key, options);
|
|
101
|
+
}
|
|
73
102
|
};
|
|
74
103
|
};
|
|
104
|
+
const checkCheckbox = async function (checkboxId) {
|
|
105
|
+
let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
106
|
+
const {
|
|
107
|
+
userId,
|
|
108
|
+
investmentId = '',
|
|
109
|
+
privateInvestorId = ''
|
|
110
|
+
} = data;
|
|
111
|
+
if (!userId) {
|
|
112
|
+
throw new Error('userId is required to check checkbox');
|
|
113
|
+
}
|
|
114
|
+
if (!checkboxId) {
|
|
115
|
+
throw new Error('checkboxId is required');
|
|
116
|
+
}
|
|
117
|
+
try {
|
|
118
|
+
const response = await (0, _fetchData.default)('compliance/check-checkbox', {
|
|
119
|
+
userId,
|
|
120
|
+
checkboxId,
|
|
121
|
+
investmentId,
|
|
122
|
+
privateInvestorId
|
|
123
|
+
});
|
|
124
|
+
return response;
|
|
125
|
+
} catch (error) {
|
|
126
|
+
console.error("Failed to check checkbox: ".concat(checkboxId), error);
|
|
127
|
+
throw error;
|
|
128
|
+
}
|
|
129
|
+
};
|
|
75
130
|
const clearCheckboxes = key => {
|
|
76
131
|
if (key) {
|
|
77
132
|
// Clear specific key
|
|
@@ -85,14 +140,21 @@ const CheckboxProvider = _ref => {
|
|
|
85
140
|
delete newState[key];
|
|
86
141
|
return newState;
|
|
87
142
|
});
|
|
143
|
+
setErrorStates(prev => {
|
|
144
|
+
const newState = _objectSpread({}, prev);
|
|
145
|
+
delete newState[key];
|
|
146
|
+
return newState;
|
|
147
|
+
});
|
|
88
148
|
} else {
|
|
89
149
|
// Clear all checkboxes
|
|
90
150
|
setCheckboxes({});
|
|
91
151
|
setLoadingStates({});
|
|
152
|
+
setErrorStates({});
|
|
92
153
|
}
|
|
93
154
|
};
|
|
94
155
|
const value = {
|
|
95
156
|
getCheckboxes,
|
|
157
|
+
checkCheckbox,
|
|
96
158
|
clearCheckboxes
|
|
97
159
|
};
|
|
98
160
|
return /*#__PURE__*/_react.default.createElement(CheckboxContext.Provider, {
|
|
@@ -111,4 +173,16 @@ const useCheckboxes = function (key) {
|
|
|
111
173
|
}
|
|
112
174
|
return context.getCheckboxes(key, options);
|
|
113
175
|
};
|
|
114
|
-
exports.useCheckboxes = useCheckboxes;
|
|
176
|
+
exports.useCheckboxes = useCheckboxes;
|
|
177
|
+
const useCheckboxActions = () => {
|
|
178
|
+
const context = (0, _react.useContext)(CheckboxContext);
|
|
179
|
+
if (!context) {
|
|
180
|
+
throw new Error('useCheckboxActions must be used within CheckboxProvider');
|
|
181
|
+
}
|
|
182
|
+
return {
|
|
183
|
+
checkCheckbox: context.checkCheckbox,
|
|
184
|
+
uncheckCheckbox: context.uncheckCheckbox,
|
|
185
|
+
clearCheckboxes: context.clearCheckboxes
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
exports.useCheckboxActions = useCheckboxActions;
|
package/dist/index.js
CHANGED
|
@@ -124,28 +124,6 @@ Object.keys(_CaptialRaisedSummary).forEach(function (key) {
|
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
126
|
});
|
|
127
|
-
var _ChartBox = require("./components/ChartBox/ChartBox");
|
|
128
|
-
Object.keys(_ChartBox).forEach(function (key) {
|
|
129
|
-
if (key === "default" || key === "__esModule") return;
|
|
130
|
-
if (key in exports && exports[key] === _ChartBox[key]) return;
|
|
131
|
-
Object.defineProperty(exports, key, {
|
|
132
|
-
enumerable: true,
|
|
133
|
-
get: function () {
|
|
134
|
-
return _ChartBox[key];
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
var _ChartBoxDistribution = require("./components/ChartBox/ChartBoxDistribution");
|
|
139
|
-
Object.keys(_ChartBoxDistribution).forEach(function (key) {
|
|
140
|
-
if (key === "default" || key === "__esModule") return;
|
|
141
|
-
if (key in exports && exports[key] === _ChartBoxDistribution[key]) return;
|
|
142
|
-
Object.defineProperty(exports, key, {
|
|
143
|
-
enumerable: true,
|
|
144
|
-
get: function () {
|
|
145
|
-
return _ChartBoxDistribution[key];
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
127
|
var _ChartLegend = require("./components/ChartLegend/ChartLegend");
|
|
150
128
|
Object.keys(_ChartLegend).forEach(function (key) {
|
|
151
129
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -487,28 +465,6 @@ Object.keys(_SpanButton).forEach(function (key) {
|
|
|
487
465
|
}
|
|
488
466
|
});
|
|
489
467
|
});
|
|
490
|
-
var _KYCFlow = require("./components/KYCFlow");
|
|
491
|
-
Object.keys(_KYCFlow).forEach(function (key) {
|
|
492
|
-
if (key === "default" || key === "__esModule") return;
|
|
493
|
-
if (key in exports && exports[key] === _KYCFlow[key]) return;
|
|
494
|
-
Object.defineProperty(exports, key, {
|
|
495
|
-
enumerable: true,
|
|
496
|
-
get: function () {
|
|
497
|
-
return _KYCFlow[key];
|
|
498
|
-
}
|
|
499
|
-
});
|
|
500
|
-
});
|
|
501
|
-
var _KYCSelectBox = require("./components/KYCSelectBox/KYCSelectBox.styles");
|
|
502
|
-
Object.keys(_KYCSelectBox).forEach(function (key) {
|
|
503
|
-
if (key === "default" || key === "__esModule") return;
|
|
504
|
-
if (key in exports && exports[key] === _KYCSelectBox[key]) return;
|
|
505
|
-
Object.defineProperty(exports, key, {
|
|
506
|
-
enumerable: true,
|
|
507
|
-
get: function () {
|
|
508
|
-
return _KYCSelectBox[key];
|
|
509
|
-
}
|
|
510
|
-
});
|
|
511
|
-
});
|
|
512
468
|
var _LatestUpdate = require("./components/LatestUpdate/LatestUpdate");
|
|
513
469
|
Object.keys(_LatestUpdate).forEach(function (key) {
|
|
514
470
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -707,17 +663,6 @@ Object.keys(_Process).forEach(function (key) {
|
|
|
707
663
|
}
|
|
708
664
|
});
|
|
709
665
|
});
|
|
710
|
-
var _ProofOfAddress = require("./components/ProofOfAddress/ProofOfAddress.styles");
|
|
711
|
-
Object.keys(_ProofOfAddress).forEach(function (key) {
|
|
712
|
-
if (key === "default" || key === "__esModule") return;
|
|
713
|
-
if (key in exports && exports[key] === _ProofOfAddress[key]) return;
|
|
714
|
-
Object.defineProperty(exports, key, {
|
|
715
|
-
enumerable: true,
|
|
716
|
-
get: function () {
|
|
717
|
-
return _ProofOfAddress[key];
|
|
718
|
-
}
|
|
719
|
-
});
|
|
720
|
-
});
|
|
721
666
|
var _ProfileBadge = require("./components/ProfileBadge/ProfileBadge");
|
|
722
667
|
Object.keys(_ProfileBadge).forEach(function (key) {
|
|
723
668
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -850,17 +795,6 @@ Object.keys(_SideLine).forEach(function (key) {
|
|
|
850
795
|
}
|
|
851
796
|
});
|
|
852
797
|
});
|
|
853
|
-
var _SigningSubflow = require("./components/SigningSubflow");
|
|
854
|
-
Object.keys(_SigningSubflow).forEach(function (key) {
|
|
855
|
-
if (key === "default" || key === "__esModule") return;
|
|
856
|
-
if (key in exports && exports[key] === _SigningSubflow[key]) return;
|
|
857
|
-
Object.defineProperty(exports, key, {
|
|
858
|
-
enumerable: true,
|
|
859
|
-
get: function () {
|
|
860
|
-
return _SigningSubflow[key];
|
|
861
|
-
}
|
|
862
|
-
});
|
|
863
|
-
});
|
|
864
798
|
var _Slider = require("./components/Slider/Slider");
|
|
865
799
|
Object.keys(_Slider).forEach(function (key) {
|
|
866
800
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1103,17 +1037,6 @@ Object.keys(_TransactionInfo).forEach(function (key) {
|
|
|
1103
1037
|
}
|
|
1104
1038
|
});
|
|
1105
1039
|
});
|
|
1106
|
-
var _TwoFactorModal = require("./components/TwoFactorModal/TwoFactorModal");
|
|
1107
|
-
Object.keys(_TwoFactorModal).forEach(function (key) {
|
|
1108
|
-
if (key === "default" || key === "__esModule") return;
|
|
1109
|
-
if (key in exports && exports[key] === _TwoFactorModal[key]) return;
|
|
1110
|
-
Object.defineProperty(exports, key, {
|
|
1111
|
-
enumerable: true,
|
|
1112
|
-
get: function () {
|
|
1113
|
-
return _TwoFactorModal[key];
|
|
1114
|
-
}
|
|
1115
|
-
});
|
|
1116
|
-
});
|
|
1117
1040
|
var _Layout = require("./components/Layout/Layout");
|
|
1118
1041
|
Object.keys(_Layout).forEach(function (key) {
|
|
1119
1042
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1476,4 +1399,48 @@ Object.keys(_useTimer).forEach(function (key) {
|
|
|
1476
1399
|
return _useTimer[key];
|
|
1477
1400
|
}
|
|
1478
1401
|
});
|
|
1402
|
+
});
|
|
1403
|
+
var _PaymentDisplay = require("./components/Payment/PaymentDisplay");
|
|
1404
|
+
Object.keys(_PaymentDisplay).forEach(function (key) {
|
|
1405
|
+
if (key === "default" || key === "__esModule") return;
|
|
1406
|
+
if (key in exports && exports[key] === _PaymentDisplay[key]) return;
|
|
1407
|
+
Object.defineProperty(exports, key, {
|
|
1408
|
+
enumerable: true,
|
|
1409
|
+
get: function () {
|
|
1410
|
+
return _PaymentDisplay[key];
|
|
1411
|
+
}
|
|
1412
|
+
});
|
|
1413
|
+
});
|
|
1414
|
+
var _TimerComponent = require("./components/Payment/TimerComponent");
|
|
1415
|
+
Object.keys(_TimerComponent).forEach(function (key) {
|
|
1416
|
+
if (key === "default" || key === "__esModule") return;
|
|
1417
|
+
if (key in exports && exports[key] === _TimerComponent[key]) return;
|
|
1418
|
+
Object.defineProperty(exports, key, {
|
|
1419
|
+
enumerable: true,
|
|
1420
|
+
get: function () {
|
|
1421
|
+
return _TimerComponent[key];
|
|
1422
|
+
}
|
|
1423
|
+
});
|
|
1424
|
+
});
|
|
1425
|
+
var _Timeline = require("./components/Timeline/Timeline");
|
|
1426
|
+
Object.keys(_Timeline).forEach(function (key) {
|
|
1427
|
+
if (key === "default" || key === "__esModule") return;
|
|
1428
|
+
if (key in exports && exports[key] === _Timeline[key]) return;
|
|
1429
|
+
Object.defineProperty(exports, key, {
|
|
1430
|
+
enumerable: true,
|
|
1431
|
+
get: function () {
|
|
1432
|
+
return _Timeline[key];
|
|
1433
|
+
}
|
|
1434
|
+
});
|
|
1435
|
+
});
|
|
1436
|
+
var _TimelineStep = require("./components/Timeline/TimelineStep");
|
|
1437
|
+
Object.keys(_TimelineStep).forEach(function (key) {
|
|
1438
|
+
if (key === "default" || key === "__esModule") return;
|
|
1439
|
+
if (key in exports && exports[key] === _TimelineStep[key]) return;
|
|
1440
|
+
Object.defineProperty(exports, key, {
|
|
1441
|
+
enumerable: true,
|
|
1442
|
+
get: function () {
|
|
1443
|
+
return _TimelineStep[key];
|
|
1444
|
+
}
|
|
1445
|
+
});
|
|
1479
1446
|
});
|