@stokr/components-library 2.3.64 → 2.3.65-beta.10
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/2FA/main-flow.js +28 -7
- package/dist/components/2FA/main-flow.stories.js +144 -15
- package/dist/components/AdminDashboard/Table/ReactTable.js +123 -7
- package/dist/components/AdminDashboard/Table/ReactTable.stories.js +509 -2
- package/dist/components/Chips/Chip.js +1 -2
- package/dist/components/Icon/Icon.stories.js +108 -0
- package/dist/components/InfoIcon/InfoIcon.js +9 -4
- package/dist/components/InfoIcon/InfoIcon.styles.js +3 -3
- package/dist/components/Input/Input.js +33 -33
- package/dist/components/Input/Input.stories.js +83 -8
- package/dist/components/Input/MultiSelect.js +319 -0
- package/dist/components/Input/MultiSelect.stories.js +264 -0
- package/dist/components/Input/SearchInput.js +78 -0
- package/dist/components/Input/SearchInput.stories.js +366 -0
- package/dist/components/Input/SearchInput.styles.js +25 -0
- package/dist/components/Input/Select.js +51 -28
- package/dist/components/Input/Select.stories.js +345 -6
- package/dist/components/Modal/SideModal.js +82 -0
- package/dist/components/Modal/SideModal.stories.js +342 -0
- package/dist/components/Modal/SideModal.styles.js +21 -0
- package/dist/components/Payment/PaymentDetailsCard.js +189 -0
- package/dist/components/Payment/PaymentDetailsCard.stories.js +198 -0
- package/dist/components/Payment/PaymentDisplay.js +2 -12
- package/dist/components/ProfileBox/ProfileBox.js +2 -1
- package/dist/components/Snackbar/Snackbar.js +193 -0
- package/dist/components/Snackbar/Snackbar.stories.js +292 -0
- package/dist/components/Snackbar/Snackbar.styles.js +97 -0
- package/dist/components/Snackbar/SnackbarProvider.js +81 -0
- package/dist/components/Snackbar/index.js +32 -0
- package/dist/components/Snackbar/useSnackbar.js +43 -0
- package/dist/components/StatusTag/StatusTag.js +175 -0
- package/dist/components/StatusTag/StatusTag.stories.js +262 -0
- package/dist/components/StatusTag/StatusTag.styles.js +37 -0
- package/dist/components/StepsProgress/StepIndicator.js +59 -0
- package/dist/components/StepsProgress/StepIndicator.stories.js +153 -0
- package/dist/components/StepsProgress/StepIndicator.styles.js +30 -0
- package/dist/components/TextLink/TextLink.stories.js +35 -0
- package/dist/components/TextLink/TextLink.styles.js +1 -1
- package/dist/components/Timeline/Timeline.js +0 -2
- package/dist/components/Timeline/TimelineStep.js +2 -2
- package/dist/components/logo/Logo.stories.js +260 -0
- package/dist/constants/globalVariables.js +41 -2
- package/dist/context/Checkbox/CheckboxContext.js +80 -7
- package/dist/index.js +66 -0
- package/dist/static/images/bmn2-logo.svg +9 -0
- package/dist/static/images/document-icon.svg +3 -0
- package/dist/static/images/plus-icon.svg +4 -0
- package/dist/static/images/search-icon.svg +3 -0
- package/dist/static/images/sent-icon.svg +10 -0
- package/dist/static/images/transfer-icon.svg +10 -0
- package/dist/utils/formatCurrencyValue.js +43 -3
- package/package.json +1 -1
|
@@ -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,15 @@ 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
|
+
clearCheckboxes: context.clearCheckboxes
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
exports.useCheckboxActions = useCheckboxActions;
|
package/dist/index.js
CHANGED
|
@@ -399,6 +399,17 @@ Object.keys(_Select).forEach(function (key) {
|
|
|
399
399
|
}
|
|
400
400
|
});
|
|
401
401
|
});
|
|
402
|
+
var _MultiSelect = require("./components/Input/MultiSelect");
|
|
403
|
+
Object.keys(_MultiSelect).forEach(function (key) {
|
|
404
|
+
if (key === "default" || key === "__esModule") return;
|
|
405
|
+
if (key in exports && exports[key] === _MultiSelect[key]) return;
|
|
406
|
+
Object.defineProperty(exports, key, {
|
|
407
|
+
enumerable: true,
|
|
408
|
+
get: function () {
|
|
409
|
+
return _MultiSelect[key];
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
});
|
|
402
413
|
var _OtpInput = require("./components/Input/OtpInput");
|
|
403
414
|
Object.keys(_OtpInput).forEach(function (key) {
|
|
404
415
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -608,6 +619,17 @@ Object.keys(_NewVentureModal).forEach(function (key) {
|
|
|
608
619
|
}
|
|
609
620
|
});
|
|
610
621
|
});
|
|
622
|
+
var _SideModal = require("./components/Modal/SideModal");
|
|
623
|
+
Object.keys(_SideModal).forEach(function (key) {
|
|
624
|
+
if (key === "default" || key === "__esModule") return;
|
|
625
|
+
if (key in exports && exports[key] === _SideModal[key]) return;
|
|
626
|
+
Object.defineProperty(exports, key, {
|
|
627
|
+
enumerable: true,
|
|
628
|
+
get: function () {
|
|
629
|
+
return _SideModal[key];
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
});
|
|
611
633
|
var _MultiProgressBar = require("./components/MultiProgressBar/MultiProgressBar");
|
|
612
634
|
Object.keys(_MultiProgressBar).forEach(function (key) {
|
|
613
635
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1422,6 +1444,17 @@ Object.keys(_TimerComponent).forEach(function (key) {
|
|
|
1422
1444
|
}
|
|
1423
1445
|
});
|
|
1424
1446
|
});
|
|
1447
|
+
var _PaymentDetailsCard = require("./components/Payment/PaymentDetailsCard");
|
|
1448
|
+
Object.keys(_PaymentDetailsCard).forEach(function (key) {
|
|
1449
|
+
if (key === "default" || key === "__esModule") return;
|
|
1450
|
+
if (key in exports && exports[key] === _PaymentDetailsCard[key]) return;
|
|
1451
|
+
Object.defineProperty(exports, key, {
|
|
1452
|
+
enumerable: true,
|
|
1453
|
+
get: function () {
|
|
1454
|
+
return _PaymentDetailsCard[key];
|
|
1455
|
+
}
|
|
1456
|
+
});
|
|
1457
|
+
});
|
|
1425
1458
|
var _Timeline = require("./components/Timeline/Timeline");
|
|
1426
1459
|
Object.keys(_Timeline).forEach(function (key) {
|
|
1427
1460
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1443,4 +1476,37 @@ Object.keys(_TimelineStep).forEach(function (key) {
|
|
|
1443
1476
|
return _TimelineStep[key];
|
|
1444
1477
|
}
|
|
1445
1478
|
});
|
|
1479
|
+
});
|
|
1480
|
+
var _StatusTag = require("./components/StatusTag/StatusTag");
|
|
1481
|
+
Object.keys(_StatusTag).forEach(function (key) {
|
|
1482
|
+
if (key === "default" || key === "__esModule") return;
|
|
1483
|
+
if (key in exports && exports[key] === _StatusTag[key]) return;
|
|
1484
|
+
Object.defineProperty(exports, key, {
|
|
1485
|
+
enumerable: true,
|
|
1486
|
+
get: function () {
|
|
1487
|
+
return _StatusTag[key];
|
|
1488
|
+
}
|
|
1489
|
+
});
|
|
1490
|
+
});
|
|
1491
|
+
var _StepIndicator = require("./components/StepsProgress/StepIndicator");
|
|
1492
|
+
Object.keys(_StepIndicator).forEach(function (key) {
|
|
1493
|
+
if (key === "default" || key === "__esModule") return;
|
|
1494
|
+
if (key in exports && exports[key] === _StepIndicator[key]) return;
|
|
1495
|
+
Object.defineProperty(exports, key, {
|
|
1496
|
+
enumerable: true,
|
|
1497
|
+
get: function () {
|
|
1498
|
+
return _StepIndicator[key];
|
|
1499
|
+
}
|
|
1500
|
+
});
|
|
1501
|
+
});
|
|
1502
|
+
var _Snackbar = require("./components/Snackbar");
|
|
1503
|
+
Object.keys(_Snackbar).forEach(function (key) {
|
|
1504
|
+
if (key === "default" || key === "__esModule") return;
|
|
1505
|
+
if (key in exports && exports[key] === _Snackbar[key]) return;
|
|
1506
|
+
Object.defineProperty(exports, key, {
|
|
1507
|
+
enumerable: true,
|
|
1508
|
+
get: function () {
|
|
1509
|
+
return _Snackbar[key];
|
|
1510
|
+
}
|
|
1511
|
+
});
|
|
1446
1512
|
});
|