@stokr/components-library 2.3.64 → 2.3.65-beta.2

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.
@@ -8,7 +8,7 @@ var _react = _interopRequireDefault(require("react"));
8
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
9
9
  var _reactTippy = require("react-tippy");
10
10
  var _InfoIcon = require("./InfoIcon.styles");
11
- const _excluded = ["title", "html", "position", "noMargin", "noMarginLeft", "noMarginRight", "noIcon", "disabled", "fullWidth", "containerStyle"];
11
+ const _excluded = ["title", "html", "position", "noMargin", "noMarginLeft", "noMarginRight", "noIcon", "disabled", "fullWidth", "outline", "containerStyle"];
12
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
13
13
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
14
14
  function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
@@ -24,6 +24,7 @@ const InfoIcon = _ref => {
24
24
  noIcon,
25
25
  disabled,
26
26
  fullWidth,
27
+ outline,
27
28
  containerStyle
28
29
  } = _ref,
29
30
  props = _objectWithoutProperties(_ref, _excluded);
@@ -43,7 +44,9 @@ const InfoIcon = _ref => {
43
44
  // onRequestClose={() => console.log('request to close tooltip')}
44
45
  ,
45
46
  disabled: disabled
46
- }), noIcon ? props.children : /*#__PURE__*/_react.default.createElement(_InfoIcon.Icon, null)));
47
+ }), noIcon ? props.children : /*#__PURE__*/_react.default.createElement(_InfoIcon.Icon, {
48
+ outline: outline
49
+ })));
47
50
  };
48
51
  exports.InfoIcon = InfoIcon;
49
52
  InfoIcon.propTypes = {
@@ -52,7 +55,8 @@ InfoIcon.propTypes = {
52
55
  position: _propTypes.default.oneOf(['top', 'bottom', 'left', 'right']),
53
56
  noMargin: _propTypes.default.bool,
54
57
  noMarginLeft: _propTypes.default.bool,
55
- noMarginRight: _propTypes.default.bool
58
+ noMarginRight: _propTypes.default.bool,
59
+ outline: _propTypes.default.bool
56
60
  };
57
61
  InfoIcon.defaultProps = {
58
62
  title: null,
@@ -60,6 +64,7 @@ InfoIcon.defaultProps = {
60
64
  position: 'bottom',
61
65
  noMargin: false,
62
66
  noMarginLeft: false,
63
- noMarginRight: false
67
+ noMarginRight: false,
68
+ outline: false
64
69
  };
65
70
  var _default = exports.default = InfoIcon;
@@ -11,9 +11,9 @@ const Container = exports.Container = _styledComponents.default.div.withConfig({
11
11
  displayName: "InfoIconstyles__Container",
12
12
  componentId: "sc-d3sdn3-0"
13
13
  })(["display:inline-block;vertical-align:middle;margin:0 12px;font-size:0;line-height:0;", " ", " ", " ", " & > div{position:relative;display:inline-block !important;", "}"], props => props.noMargin && "\n margin: 0;\n ", props => props.noMarginLeft && "\n margin-left: 0;\n ", props => props.noMarginRight && "\n margin-right: 0;\n ", props => props.fullWidth && "\n width: 100%;\n height: 100%;\n ", props => props.fullWidth && "\n width: 100%;\n height: 100%;\n display: flex !important;\n align-content: center;\n flex-wrap: wrap;\n justify-content: center;\n ");
14
- const Icon = exports.Icon = _styledComponents.default.i.attrs({
15
- className: 'ion ion-md-information-circle'
16
- }).withConfig({
14
+ const Icon = exports.Icon = _styledComponents.default.i.attrs(props => ({
15
+ className: props.outline ? 'ion ion-md-information-circle-outline' : 'ion ion-md-information-circle'
16
+ })).withConfig({
17
17
  displayName: "InfoIconstyles__Icon",
18
18
  componentId: "sc-d3sdn3-1"
19
19
  })(["position:relative;left:-0.4px;display:inline-block;vertical-align:middle;font-size:16px;line-height:16px;vertical-align:middle;color:", ";transition:color 0.2s;&:hover{color:", ";}"], props => _theme.default.cGrey2, props => _theme.default.cPrimary);
@@ -12,7 +12,6 @@ const Timeline = _ref => {
12
12
  let {
13
13
  steps = [],
14
14
  maxWidth,
15
- dateFormat,
16
15
  showInfoIcons = true,
17
16
  infoIconPosition = 'right',
18
17
  // Style props
@@ -41,7 +40,6 @@ const Timeline = _ref => {
41
40
  customIcon: step.customIcon,
42
41
  showInfoIcon: showInfoIcons,
43
42
  infoIconPosition: infoIconPosition,
44
- dateFormat: dateFormat,
45
43
  stepStyle: step.stepStyle || stepStyle,
46
44
  iconStyle: step.iconStyle || iconStyle,
47
45
  contentStyle: step.contentStyle || contentStyle,
@@ -8,8 +8,8 @@ var _react = _interopRequireDefault(require("react"));
8
8
  var _Icon = require("../Icon/Icon.style");
9
9
  var _InfoIcon = require("../InfoIcon/InfoIcon");
10
10
  var _Timeline = require("./Timeline.styles");
11
- var _crossIcon = require("static/images/cross-icon.svg");
12
- var _checkIcon = require("static/images/check-icon.svg");
11
+ var _crossIcon = require("../../static/images/cross-icon.svg");
12
+ var _checkIcon = require("../../static/images/check-icon.svg");
13
13
  var _moment = _interopRequireDefault(require("moment"));
14
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
15
  const TimelineStep = _ref => {
@@ -0,0 +1,260 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = exports.SvgFile = exports.Small = exports.OnDifferentBackgrounds = exports.Medium = exports.LogoSvgComponent = exports.Large = exports.Default = exports.AllVersions = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _Logo = require("./Logo");
9
+ var _LogoSvg = _interopRequireDefault(require("../SvgIcons/LogoSvg"));
10
+ var _ComponentWrapper = require("../ComponentWrapper/ComponentWrapper.styles");
11
+ var _global = _interopRequireDefault(require("../../styles/global"));
12
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
+ var _logo = _interopRequireDefault(require("../../static/images/logo.svg"));
14
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
+ // Import the SVG file as an image
16
+
17
+ const ComparisonContainer = _styledComponents.default.div.withConfig({
18
+ displayName: "Logostories__ComparisonContainer",
19
+ componentId: "sc-e8wyjz-0"
20
+ })(["display:flex;flex-direction:column;gap:32px;padding:24px;"]);
21
+ const LogoSection = _styledComponents.default.div.withConfig({
22
+ displayName: "Logostories__LogoSection",
23
+ componentId: "sc-e8wyjz-1"
24
+ })(["display:flex;flex-direction:column;gap:16px;padding:20px;border:1px solid #e1e1e1;border-radius:8px;background-color:#f8f8f8;"]);
25
+ const LogoTitle = _styledComponents.default.h3.withConfig({
26
+ displayName: "Logostories__LogoTitle",
27
+ componentId: "sc-e8wyjz-2"
28
+ })(["font-size:18px;font-weight:600;margin:0 0 8px 0;color:#202020;"]);
29
+ const LogoDescription = _styledComponents.default.p.withConfig({
30
+ displayName: "Logostories__LogoDescription",
31
+ componentId: "sc-e8wyjz-3"
32
+ })(["font-size:14px;color:#666;margin:0 0 16px 0;"]);
33
+ const LogoDisplay = _styledComponents.default.div.withConfig({
34
+ displayName: "Logostories__LogoDisplay",
35
+ componentId: "sc-e8wyjz-4"
36
+ })(["display:flex;align-items:center;gap:24px;padding:16px;background-color:white;border-radius:4px;min-height:60px;"]);
37
+ const SizeLabel = _styledComponents.default.span.withConfig({
38
+ displayName: "Logostories__SizeLabel",
39
+ componentId: "sc-e8wyjz-5"
40
+ })(["font-size:12px;color:#999;min-width:100px;"]);
41
+ var _default = exports.default = {
42
+ title: 'Components Library/Logo',
43
+ component: _Logo.Logo,
44
+ argTypes: {
45
+ width: {
46
+ control: 'number',
47
+ description: 'Width of the logo in pixels'
48
+ },
49
+ height: {
50
+ control: 'number',
51
+ description: 'Height of the logo in pixels'
52
+ }
53
+ },
54
+ 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)))]
55
+ }; // Logo.jsx component template
56
+ const LogoTemplate = args => /*#__PURE__*/_react.default.createElement(_Logo.Logo, args);
57
+
58
+ // Comparison view showing all versions
59
+ const AllVersions = () => /*#__PURE__*/_react.default.createElement(ComparisonContainer, null, /*#__PURE__*/_react.default.createElement(LogoSection, null, /*#__PURE__*/_react.default.createElement(LogoTitle, null, "Logo.jsx (Class Component)"), /*#__PURE__*/_react.default.createElement(LogoDescription, null, "Class component with customizable width and height props. Default: 70x17"), /*#__PURE__*/_react.default.createElement(LogoDisplay, null, /*#__PURE__*/_react.default.createElement(SizeLabel, null, "Default (70x17):"), /*#__PURE__*/_react.default.createElement(_Logo.Logo, null)), /*#__PURE__*/_react.default.createElement(LogoDisplay, null, /*#__PURE__*/_react.default.createElement(SizeLabel, null, "Custom (100x24):"), /*#__PURE__*/_react.default.createElement(_Logo.Logo, {
60
+ width: 100,
61
+ height: 24
62
+ })), /*#__PURE__*/_react.default.createElement(LogoDisplay, null, /*#__PURE__*/_react.default.createElement(SizeLabel, null, "Small (50x12):"), /*#__PURE__*/_react.default.createElement(_Logo.Logo, {
63
+ width: 50,
64
+ height: 12
65
+ })), /*#__PURE__*/_react.default.createElement(LogoDisplay, null, /*#__PURE__*/_react.default.createElement(SizeLabel, null, "Large (140x34):"), /*#__PURE__*/_react.default.createElement(_Logo.Logo, {
66
+ width: 140,
67
+ height: 34
68
+ }))), /*#__PURE__*/_react.default.createElement(LogoSection, null, /*#__PURE__*/_react.default.createElement(LogoTitle, null, "LogoSvg.js (Functional Component)"), /*#__PURE__*/_react.default.createElement(LogoDescription, null, "Functional component with fixed size: 66px x 16px"), /*#__PURE__*/_react.default.createElement(LogoDisplay, null, /*#__PURE__*/_react.default.createElement(SizeLabel, null, "Fixed Size:"), /*#__PURE__*/_react.default.createElement(_LogoSvg.default, null))), /*#__PURE__*/_react.default.createElement(LogoSection, null, /*#__PURE__*/_react.default.createElement(LogoTitle, null, "logo.svg (Image File)"), /*#__PURE__*/_react.default.createElement(LogoDescription, null, "SVG file imported as an image. Can be used with img tag or as background"), /*#__PURE__*/_react.default.createElement(LogoDisplay, null, /*#__PURE__*/_react.default.createElement(SizeLabel, null, "As img tag:"), /*#__PURE__*/_react.default.createElement("img", {
69
+ src: _logo.default,
70
+ alt: "STOKR Logo",
71
+ style: {
72
+ height: '17px'
73
+ }
74
+ })), /*#__PURE__*/_react.default.createElement(LogoDisplay, null, /*#__PURE__*/_react.default.createElement(SizeLabel, null, "Larger size:"), /*#__PURE__*/_react.default.createElement("img", {
75
+ src: _logo.default,
76
+ alt: "STOKR Logo",
77
+ style: {
78
+ height: '34px'
79
+ }
80
+ })), /*#__PURE__*/_react.default.createElement(LogoDisplay, null, /*#__PURE__*/_react.default.createElement(SizeLabel, null, "As background:"), /*#__PURE__*/_react.default.createElement("div", {
81
+ style: {
82
+ width: '70px',
83
+ height: '17px',
84
+ backgroundImage: "url(".concat(_logo.default, ")"),
85
+ backgroundSize: 'contain',
86
+ backgroundRepeat: 'no-repeat',
87
+ backgroundPosition: 'center'
88
+ }
89
+ }))), /*#__PURE__*/_react.default.createElement(LogoSection, null, /*#__PURE__*/_react.default.createElement(LogoTitle, null, "Side by Side Comparison"), /*#__PURE__*/_react.default.createElement(LogoDescription, null, "All three versions at similar sizes for direct comparison"), /*#__PURE__*/_react.default.createElement(LogoDisplay, null, /*#__PURE__*/_react.default.createElement("div", {
90
+ style: {
91
+ display: 'flex',
92
+ flexDirection: 'column',
93
+ gap: '16px'
94
+ }
95
+ }, /*#__PURE__*/_react.default.createElement("div", {
96
+ style: {
97
+ display: 'flex',
98
+ alignItems: 'center',
99
+ gap: '16px'
100
+ }
101
+ }, /*#__PURE__*/_react.default.createElement(SizeLabel, null, "Logo.jsx:"), /*#__PURE__*/_react.default.createElement(_Logo.Logo, {
102
+ width: 70,
103
+ height: 17
104
+ })), /*#__PURE__*/_react.default.createElement("div", {
105
+ style: {
106
+ display: 'flex',
107
+ alignItems: 'center',
108
+ gap: '16px'
109
+ }
110
+ }, /*#__PURE__*/_react.default.createElement(SizeLabel, null, "LogoSvg.js:"), /*#__PURE__*/_react.default.createElement(_LogoSvg.default, null)), /*#__PURE__*/_react.default.createElement("div", {
111
+ style: {
112
+ display: 'flex',
113
+ alignItems: 'center',
114
+ gap: '16px'
115
+ }
116
+ }, /*#__PURE__*/_react.default.createElement(SizeLabel, null, "logo.svg:"), /*#__PURE__*/_react.default.createElement("img", {
117
+ src: _logo.default,
118
+ alt: "STOKR Logo",
119
+ style: {
120
+ height: '17px'
121
+ }
122
+ }))))));
123
+
124
+ // Default Logo.jsx
125
+ exports.AllVersions = AllVersions;
126
+ const Default = exports.Default = LogoTemplate.bind({});
127
+ Default.args = {
128
+ width: 70,
129
+ height: 17
130
+ };
131
+
132
+ // Small size
133
+ const Small = exports.Small = LogoTemplate.bind({});
134
+ Small.args = {
135
+ width: 50,
136
+ height: 12
137
+ };
138
+
139
+ // Medium size
140
+ const Medium = exports.Medium = LogoTemplate.bind({});
141
+ Medium.args = {
142
+ width: 100,
143
+ height: 24
144
+ };
145
+
146
+ // Large size
147
+ const Large = exports.Large = LogoTemplate.bind({});
148
+ Large.args = {
149
+ width: 140,
150
+ height: 34
151
+ };
152
+
153
+ // LogoSvg component
154
+ const LogoSvgComponent = () => /*#__PURE__*/_react.default.createElement("div", {
155
+ style: {
156
+ padding: '20px'
157
+ }
158
+ }, /*#__PURE__*/_react.default.createElement(_LogoSvg.default, null));
159
+
160
+ // SVG file as image
161
+ exports.LogoSvgComponent = LogoSvgComponent;
162
+ const SvgFile = () => /*#__PURE__*/_react.default.createElement("div", {
163
+ style: {
164
+ padding: '20px',
165
+ display: 'flex',
166
+ flexDirection: 'column',
167
+ gap: '16px'
168
+ }
169
+ }, /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", {
170
+ style: {
171
+ marginBottom: '8px',
172
+ fontSize: '14px',
173
+ color: '#666'
174
+ }
175
+ }, "Default size:"), /*#__PURE__*/_react.default.createElement("img", {
176
+ src: _logo.default,
177
+ alt: "STOKR Logo"
178
+ })), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", {
179
+ style: {
180
+ marginBottom: '8px',
181
+ fontSize: '14px',
182
+ color: '#666'
183
+ }
184
+ }, "Custom height (34px):"), /*#__PURE__*/_react.default.createElement("img", {
185
+ src: _logo.default,
186
+ alt: "STOKR Logo",
187
+ style: {
188
+ height: '34px'
189
+ }
190
+ })), /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("p", {
191
+ style: {
192
+ marginBottom: '8px',
193
+ fontSize: '14px',
194
+ color: '#666'
195
+ }
196
+ }, "Custom height (50px):"), /*#__PURE__*/_react.default.createElement("img", {
197
+ src: _logo.default,
198
+ alt: "STOKR Logo",
199
+ style: {
200
+ height: '50px'
201
+ }
202
+ })));
203
+
204
+ // Different backgrounds for testing visibility
205
+ exports.SvgFile = SvgFile;
206
+ const OnDifferentBackgrounds = () => /*#__PURE__*/_react.default.createElement("div", {
207
+ style: {
208
+ display: 'flex',
209
+ flexDirection: 'column',
210
+ gap: '24px',
211
+ padding: '20px'
212
+ }
213
+ }, /*#__PURE__*/_react.default.createElement("div", {
214
+ style: {
215
+ padding: '20px',
216
+ backgroundColor: '#ffffff',
217
+ borderRadius: '8px'
218
+ }
219
+ }, /*#__PURE__*/_react.default.createElement("p", {
220
+ style: {
221
+ marginBottom: '12px',
222
+ fontSize: '14px',
223
+ fontWeight: '600'
224
+ }
225
+ }, "White Background:"), /*#__PURE__*/_react.default.createElement(_Logo.Logo, {
226
+ width: 70,
227
+ height: 17
228
+ })), /*#__PURE__*/_react.default.createElement("div", {
229
+ style: {
230
+ padding: '20px',
231
+ backgroundColor: '#f8f8f8',
232
+ borderRadius: '8px'
233
+ }
234
+ }, /*#__PURE__*/_react.default.createElement("p", {
235
+ style: {
236
+ marginBottom: '12px',
237
+ fontSize: '14px',
238
+ fontWeight: '600'
239
+ }
240
+ }, "Light Grey Background:"), /*#__PURE__*/_react.default.createElement(_Logo.Logo, {
241
+ width: 70,
242
+ height: 17
243
+ })), /*#__PURE__*/_react.default.createElement("div", {
244
+ style: {
245
+ padding: '20px',
246
+ backgroundColor: '#202020',
247
+ borderRadius: '8px'
248
+ }
249
+ }, /*#__PURE__*/_react.default.createElement("p", {
250
+ style: {
251
+ marginBottom: '12px',
252
+ fontSize: '14px',
253
+ fontWeight: '600',
254
+ color: 'white'
255
+ }
256
+ }, "Dark Background (Logo should be visible):"), /*#__PURE__*/_react.default.createElement(_Logo.Logo, {
257
+ width: 70,
258
+ height: 17
259
+ })));
260
+ exports.OnDifferentBackgrounds = OnDifferentBackgrounds;
@@ -3,7 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.walletTypes = exports.platformURL = exports.platformDomain = exports.emailRegex = exports.UserTypes = exports.USInvestorAcreditationStatuses = exports.ProjectTypes = exports.ProjectStatus = exports.ProjectStates = exports.ProfessionalInvestorStatuses = void 0;
6
+ exports.walletTypes = exports.transactionTypeDisplayNames = exports.platformURL = exports.platformDomain = exports.emailRegex = exports.UserTypes = exports.USInvestorAcreditationStatuses = exports.TransactionTypes = exports.ProjectTypes = exports.ProjectStatus = exports.ProjectStates = exports.ProfessionalInvestorStatuses = exports.LoanActivityTypes = void 0;
7
+ 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; }
8
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
9
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
10
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
11
+ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
12
  const platformDomain = exports.platformDomain = process.env.REACT_APP_WEBSITE_DOMAIN;
8
13
  const platformURL = exports.platformURL = 'https://' + platformDomain;
9
14
  const walletTypes = exports.walletTypes = {
@@ -44,4 +49,38 @@ const USInvestorAcreditationStatuses = exports.USInvestorAcreditationStatuses =
44
49
  };
45
50
 
46
51
  // should be used for all email form validation globally
47
- const emailRegex = exports.emailRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i;
52
+ const emailRegex = exports.emailRegex = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/i;
53
+ const LoanActivityTypes = exports.LoanActivityTypes = {
54
+ PRINCIPAL_DEPOSIT: 'principal_deposit',
55
+ PRINCIPAL_RELEASE: 'principal_release',
56
+ INTEREST_PAYMENT: 'interest_payment',
57
+ COLLATERAL_DEPOSIT: 'collateral_deposit',
58
+ COLLATERAL_RELEASE: 'collateral_release',
59
+ COLLATERAL_PARTIAL_DEPOSIT: 'collateral_partial_deposit',
60
+ COLLATERAL_PARTIAL_RELEASE: 'collateral_partial_release',
61
+ LIQUIDATION: 'liquidation'
62
+ };
63
+ const TransactionTypes = exports.TransactionTypes = _objectSpread({
64
+ SUBSCRIPTION: 'subscription',
65
+ REFUND: 'refund',
66
+ REDEMPTION: 'redemption',
67
+ VENTURE_PAYOUT: 'issuer_payout',
68
+ AGGREGATION: 'aggregation'
69
+ }, LoanActivityTypes);
70
+
71
+ // Display names for transaction types (matching the spreadsheet)
72
+ const transactionTypeDisplayNames = exports.transactionTypeDisplayNames = {
73
+ [TransactionTypes.INTEREST_PAYMENT]: 'Interest',
74
+ [TransactionTypes.COLLATERAL_DEPOSIT]: 'Collateral Deposit',
75
+ [TransactionTypes.COLLATERAL_RELEASE]: 'Collateral Release',
76
+ [TransactionTypes.COLLATERAL_PARTIAL_DEPOSIT]: 'Collateral Shift (Deposit)',
77
+ [TransactionTypes.COLLATERAL_PARTIAL_RELEASE]: 'Collateral Shift (Release)',
78
+ [TransactionTypes.PRINCIPAL_DEPOSIT]: 'Principal Increase',
79
+ [TransactionTypes.PRINCIPAL_RELEASE]: 'Principal Decrease',
80
+ [TransactionTypes.LIQUIDATION]: 'Liquidation',
81
+ [TransactionTypes.REDEMPTION]: 'Redemption',
82
+ [TransactionTypes.REFUND]: 'Refund',
83
+ [TransactionTypes.AGGREGATION]: 'Aggregation',
84
+ [TransactionTypes.VENTURE_PAYOUT]: 'Issuer Payout',
85
+ [TransactionTypes.SUBSCRIPTION]: 'Issuance'
86
+ };
@@ -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 already fetched
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 (!checkboxes[key] && !loadingStates[key]) {
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
- refetch: () => fetchCheckboxes(key, options)
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stokr/components-library",
3
- "version": "2.3.64",
3
+ "version": "2.3.65-beta.2",
4
4
  "description": "STOKR - Components Library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",