@stokr/components-library 2.3.44-beta.1 → 2.3.44-beta.3
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/AdminDashboard/Table/ReactTable.js +8 -2
- package/dist/components/AdminDashboard/Table/ReactTable.stories.js +33 -1
- package/dist/components/AdminDashboard/Table/Table.styles.js +3 -1
- package/dist/components/Checklist/ChecklistCard.styles.js +1 -1
- package/dist/components/Modal/NewVentureModal/NewVentureModal.js +456 -0
- package/dist/components/Modal/NewVentureModal/NewVentureModal.stories.js +170 -0
- package/dist/constants/globalVariables.js +2 -1
- package/dist/index.js +11 -0
- package/dist/styles/colors.js +2 -1
- package/package.json +1 -1
|
@@ -36,6 +36,7 @@ function ReactTable(props) {
|
|
|
36
36
|
isSubTable = props.isSubTable,
|
|
37
37
|
customTdStyles = props.customTdStyles,
|
|
38
38
|
customThStyles = props.customThStyles,
|
|
39
|
+
customRowHoverStyles = props.customRowHoverStyles,
|
|
39
40
|
calculateSubData = props.calculateSubData;
|
|
40
41
|
|
|
41
42
|
// Use the state and functions returned from useTable to build UI
|
|
@@ -79,7 +80,11 @@ function ReactTable(props) {
|
|
|
79
80
|
prepareRow(row);
|
|
80
81
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, {
|
|
81
82
|
key: row.id
|
|
82
|
-
}, /*#__PURE__*/_react.default.createElement(_Table.StyledReactTable.Tr,
|
|
83
|
+
}, /*#__PURE__*/_react.default.createElement(_Table.StyledReactTable.Tr, _extends({}, row.getRowProps(), {
|
|
84
|
+
customRowHoverStyles: customRowHoverStyles
|
|
85
|
+
// rowIndex={i}
|
|
86
|
+
// rowData={row.original}
|
|
87
|
+
}), row.cells.map(function (cell) {
|
|
83
88
|
var cellStyles = customTdStyles ? customTdStyles(i, row.original) : {};
|
|
84
89
|
return /*#__PURE__*/_react.default.createElement(_Table.StyledReactTable.Td, _extends({}, cell.row.getToggleRowExpandedProps(), cell.getCellProps({
|
|
85
90
|
className: cell.column.collapse ? 'collapse' : '',
|
|
@@ -118,7 +123,8 @@ ReactTable.propTypes = {
|
|
|
118
123
|
blue: _propTypes.default.bool,
|
|
119
124
|
noPagination: _propTypes.default.bool,
|
|
120
125
|
withSubTable: _propTypes.default.bool,
|
|
121
|
-
isSubTable: _propTypes.default.bool
|
|
126
|
+
isSubTable: _propTypes.default.bool,
|
|
127
|
+
customRowHoverStyles: _propTypes.default.func
|
|
122
128
|
};
|
|
123
129
|
ReactTable.defaultProps = {
|
|
124
130
|
blue: false,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = exports.WrapperWithSubTable = exports.WithoutPagination = exports.WithSubTable = exports.WithCustomStyling = exports.DefaultWrapper = exports.Default = exports.BlueWrapper = exports.BlueTable = void 0;
|
|
6
|
+
exports.default = exports.WrapperWithSubTable = exports.WithoutPagination = exports.WithSubTable = exports.WithStatusBasedHover = exports.WithRowHover = exports.WithCustomStyling = exports.DefaultWrapper = exports.Default = exports.BlueWrapper = exports.BlueTable = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _ReactTable = require("./ReactTable");
|
|
9
9
|
var _ReactTableWrapper = require("./ReactTableWrapper");
|
|
@@ -46,6 +46,9 @@ var _default = {
|
|
|
46
46
|
},
|
|
47
47
|
customThStyles: {
|
|
48
48
|
control: 'function'
|
|
49
|
+
},
|
|
50
|
+
customRowHoverStyles: {
|
|
51
|
+
control: 'function'
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
}; // Sample columns and data for demonstration
|
|
@@ -152,6 +155,25 @@ var customThStyles = function customThStyles(column) {
|
|
|
152
155
|
};
|
|
153
156
|
};
|
|
154
157
|
|
|
158
|
+
// Custom row hover styles function
|
|
159
|
+
var customRowHoverStyles = function customRowHoverStyles(rowIndex, rowData) {
|
|
160
|
+
return "\n background-color: #f0f8ff !important;\n transform: scale(1.01);\n transition: all 0.2s ease-in-out;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);\n \n td {\n background-color: #f0f8ff !important;\n border-bottom-color: #0050ca !important;\n }\n ";
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// Status-based hover styles
|
|
164
|
+
var statusBasedHoverStyles = function statusBasedHoverStyles(rowIndex, rowData) {
|
|
165
|
+
switch (rowData.status) {
|
|
166
|
+
case 'Active':
|
|
167
|
+
return "\n background-color: #e8f5e8 !important;\n td {\n background-color: #e8f5e8 !important;\n border-bottom-color: #28a745 !important;\n }\n ";
|
|
168
|
+
case 'Inactive':
|
|
169
|
+
return "\n background-color: #ffe8e8 !important;\n td {\n background-color: #ffe8e8 !important;\n border-bottom-color: #dc3545 !important;\n }\n ";
|
|
170
|
+
case 'Pending':
|
|
171
|
+
return "\n background-color: #fff3cd !important;\n td {\n background-color: #fff3cd !important;\n border-bottom-color: #ffc107 !important;\n }\n ";
|
|
172
|
+
default:
|
|
173
|
+
return "\n background-color: #f8f9fa !important;\n td {\n background-color: #f8f9fa !important;\n }\n ";
|
|
174
|
+
}
|
|
175
|
+
};
|
|
176
|
+
|
|
155
177
|
// Function to calculate sub data
|
|
156
178
|
var calculateSubData = function calculateSubData(row) {
|
|
157
179
|
return row.original.subData || [];
|
|
@@ -180,6 +202,16 @@ WithCustomStyling.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
|
180
202
|
customTdStyles: customTdStyles,
|
|
181
203
|
customThStyles: customThStyles
|
|
182
204
|
});
|
|
205
|
+
var WithRowHover = Template.bind({});
|
|
206
|
+
exports.WithRowHover = WithRowHover;
|
|
207
|
+
WithRowHover.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
208
|
+
customRowHoverStyles: customRowHoverStyles
|
|
209
|
+
});
|
|
210
|
+
var WithStatusBasedHover = Template.bind({});
|
|
211
|
+
exports.WithStatusBasedHover = WithStatusBasedHover;
|
|
212
|
+
WithStatusBasedHover.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
213
|
+
customRowHoverStyles: statusBasedHoverStyles
|
|
214
|
+
});
|
|
183
215
|
var WithSubTable = Template.bind({});
|
|
184
216
|
exports.WithSubTable = WithSubTable;
|
|
185
217
|
WithSubTable.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
@@ -115,7 +115,9 @@ exports.StyledTd = StyledTd;
|
|
|
115
115
|
var StyledTr = _styledComponents.default.tr.withConfig({
|
|
116
116
|
displayName: "Tablestyles__StyledTr",
|
|
117
117
|
componentId: "sc-pdcd6r-14"
|
|
118
|
-
})([""])
|
|
118
|
+
})(["", ""], function (props) {
|
|
119
|
+
return props.customRowHoverStyles && "\n &:hover {\n ".concat(props.customRowHoverStyles(props.rowIndex, props.rowData), "\n }\n ");
|
|
120
|
+
});
|
|
119
121
|
exports.StyledTr = StyledTr;
|
|
120
122
|
var StyledReactTable = _styledComponents.default.table.withConfig({
|
|
121
123
|
displayName: "Tablestyles__StyledReactTable",
|
|
@@ -12,7 +12,7 @@ function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(
|
|
|
12
12
|
var CardContainer = _styledComponents.default.div.withConfig({
|
|
13
13
|
displayName: "ChecklistCardstyles__CardContainer",
|
|
14
14
|
componentId: "sc-rufrg1-0"
|
|
15
|
-
})(["display:flex;flex-direction:column;align-items:flex-start;border:1px solid #eaeaea;border-radius:1px;background:#fff;padding:32px 32px 32px 32px;min-width:320px;min-height:220px;box-sizing:border-box;transition:box-shadow 0.2s;box-shadow:0 2px 8px rgba(0,0,0,0.01);position:relative;cursor:pointer;&:hover{box-shadow:0 4px 16px rgba(0,0,0,0.04);}&[aria-disabled='true']{opacity:0.5;cursor:not-allowed;}"]);
|
|
15
|
+
})(["display:flex;flex-direction:column;align-items:flex-start;border:1px solid #eaeaea;border-radius:1px;background:#fff;padding:32px 32px 32px 32px;min-width:320px;min-height:220px;height:100%;box-sizing:border-box;transition:box-shadow 0.2s;box-shadow:0 2px 8px rgba(0,0,0,0.01);position:relative;cursor:pointer;&:hover{box-shadow:0 4px 16px rgba(0,0,0,0.04);}&[aria-disabled='true']{opacity:0.5;cursor:not-allowed;}"]);
|
|
16
16
|
exports.CardContainer = CardContainer;
|
|
17
17
|
var IconBlock = _styledComponents.default.div.withConfig({
|
|
18
18
|
displayName: "ChecklistCardstyles__IconBlock",
|
|
@@ -0,0 +1,456 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.NewVentureModal = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _formik = require("formik");
|
|
11
|
+
var Yup = _interopRequireWildcard(require("yup"));
|
|
12
|
+
var _fetchDataPublic = _interopRequireDefault(require("../../../api/fetchDataPublic"));
|
|
13
|
+
var _htmlReactParser = _interopRequireDefault(require("html-react-parser"));
|
|
14
|
+
var _AuthContext = require("../../../context/AuthContext");
|
|
15
|
+
var _globalVariables = require("../../../constants/globalVariables");
|
|
16
|
+
var _Modal = require("../Modal");
|
|
17
|
+
var _Grid = require("../../Grid/Grid.styles");
|
|
18
|
+
var _Text = _interopRequireDefault(require("../../Text/Text.styles"));
|
|
19
|
+
var _Form = _interopRequireWildcard(require("../../Form/Form"));
|
|
20
|
+
var _ComponentWrapper = _interopRequireDefault(require("../../ComponentWrapper/ComponentWrapper.styles"));
|
|
21
|
+
var _Input = _interopRequireDefault(require("../../Input/Input"));
|
|
22
|
+
var _Checkbox = _interopRequireDefault(require("../../Checkbox/Checkbox"));
|
|
23
|
+
var _Button = _interopRequireDefault(require("../../Button/Button.styles"));
|
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
25
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
26
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
27
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
28
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
29
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
30
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
31
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
32
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
33
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
34
|
+
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; }
|
|
35
|
+
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; }
|
|
36
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
37
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
38
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
39
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
40
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
41
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
42
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
43
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
44
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
45
|
+
var initialFormValues = {
|
|
46
|
+
email: '',
|
|
47
|
+
name: '',
|
|
48
|
+
mailingList: false,
|
|
49
|
+
mailingListDisabled: false,
|
|
50
|
+
mailingListText: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "You just want to be updated on the project. Subscribe here for further information going forward."),
|
|
51
|
+
privateInvestorList: false,
|
|
52
|
+
privateInvestorListDisabled: false,
|
|
53
|
+
privateInvestorListText: /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "You are a professional investor or an investor willing to invest in private offerings. Subscribe here to be contacted by a dedicated team to help you confirm your eligibility for this investment.", /*#__PURE__*/_react.default.createElement("br", null), " ", /*#__PURE__*/_react.default.createElement("br", null), "You are seeking to invest on your own initiative and any potential investments arose as a result of your direct inquiry and outreach."),
|
|
54
|
+
optionalCheckBox: false,
|
|
55
|
+
optionalCheckBoxText: '',
|
|
56
|
+
optionalCheckBoxChecked: false
|
|
57
|
+
};
|
|
58
|
+
var NewVentureModal = /*#__PURE__*/(0, _react.memo)(function (props) {
|
|
59
|
+
var title = props.title,
|
|
60
|
+
description = props.description,
|
|
61
|
+
isModalOpen = props.isModalOpen,
|
|
62
|
+
onModalClose = props.onModalClose,
|
|
63
|
+
onFormSend = props.onFormSend,
|
|
64
|
+
popupError = props.popupError,
|
|
65
|
+
project = props.project,
|
|
66
|
+
_props$salesChannel = props.salesChannel,
|
|
67
|
+
salesChannel = _props$salesChannel === void 0 ? 'investor' : _props$salesChannel,
|
|
68
|
+
successMsg = props.successMsg,
|
|
69
|
+
errorMsg = props.errorMsg,
|
|
70
|
+
modalBotContent = props.modalBotContent;
|
|
71
|
+
var _useState = (0, _react.useState)(initialFormValues),
|
|
72
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
73
|
+
formValues = _useState2[0],
|
|
74
|
+
setformValues = _useState2[1];
|
|
75
|
+
var _useState3 = (0, _react.useState)(undefined),
|
|
76
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
77
|
+
successMessage = _useState4[0],
|
|
78
|
+
setSuccessMessage = _useState4[1];
|
|
79
|
+
var _useState5 = (0, _react.useState)(null),
|
|
80
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
81
|
+
errorMessage = _useState6[0],
|
|
82
|
+
seterrorMessage = _useState6[1];
|
|
83
|
+
var _React$useContext = _react.default.useContext(_AuthContext.AuthContext),
|
|
84
|
+
user = _React$useContext.user,
|
|
85
|
+
setUser = _React$useContext.setUser,
|
|
86
|
+
checkIfPrivateInvestor = _React$useContext.checkIfPrivateInvestor,
|
|
87
|
+
checkIfUserSubscribed = _React$useContext.checkIfUserSubscribed;
|
|
88
|
+
var _useState7 = (0, _react.useState)(),
|
|
89
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
90
|
+
checkboxes = _useState8[0],
|
|
91
|
+
setcheckboxes = _useState8[1];
|
|
92
|
+
var _useState9 = (0, _react.useState)([]),
|
|
93
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
94
|
+
checkedCheckboxes = _useState10[0],
|
|
95
|
+
setcheckedCheckboxes = _useState10[1];
|
|
96
|
+
var _useState11 = (0, _react.useState)(false),
|
|
97
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
98
|
+
isActionLoading = _useState12[0],
|
|
99
|
+
setisActionLoading = _useState12[1];
|
|
100
|
+
(0, _react.useEffect)(function () {
|
|
101
|
+
fecthCheckboxes();
|
|
102
|
+
}, []);
|
|
103
|
+
(0, _react.useEffect)(function () {
|
|
104
|
+
//we need to check if userData is subscribed for the selected project
|
|
105
|
+
//every time the userData or project is updated
|
|
106
|
+
//check only if these userData properties weren't checked already
|
|
107
|
+
var project = props.project;
|
|
108
|
+
if (!user || !user._id || !(project && project._id)) return;
|
|
109
|
+
if (user.isPrivateInvestor === undefined) {
|
|
110
|
+
checkIfPrivateInvestor(project);
|
|
111
|
+
}
|
|
112
|
+
if (user.isSubscribed === undefined) {
|
|
113
|
+
checkIfUserSubscribed(project);
|
|
114
|
+
}
|
|
115
|
+
}, [user, props.project]);
|
|
116
|
+
(0, _react.useEffect)(function () {
|
|
117
|
+
//when the checkboxes are fetched, set the text of the checkboxes
|
|
118
|
+
if (checkboxes) {
|
|
119
|
+
var formValuesCopy = _objectSpread({}, formValues);
|
|
120
|
+
Object.values(checkboxes).forEach(function (checkbox) {
|
|
121
|
+
if (checkbox.label === 'createPrivateInvestor') {
|
|
122
|
+
formValuesCopy.privateInvestorListText = (0, _htmlReactParser.default)(checkbox.agreementText);
|
|
123
|
+
} else if (checkbox.label === 'subscribeToProject') {
|
|
124
|
+
formValuesCopy.mailingListText = (0, _htmlReactParser.default)(checkbox.agreementText);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
setformValues(formValuesCopy);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
//change text of checkboxes if user is logged in and is already subscribed
|
|
131
|
+
if (user) {
|
|
132
|
+
var _formValuesCopy = _objectSpread({}, formValues);
|
|
133
|
+
_formValuesCopy.email = user.email;
|
|
134
|
+
_formValuesCopy.name = user.username;
|
|
135
|
+
if (user.isPrivateInvestor) {
|
|
136
|
+
_formValuesCopy.privateInvestorListText = 'You are already registered on the whitelist.';
|
|
137
|
+
_formValuesCopy.privateInvestorList = true;
|
|
138
|
+
_formValuesCopy.privateInvestorListDisabled = true;
|
|
139
|
+
} else if (user.privateInvestorStatus && user.privateInvestorStatus !== 'Admitted') {
|
|
140
|
+
//if private investor status is under review
|
|
141
|
+
_formValuesCopy.privateInvestorListText = 'Your profile is under review. An account manager will reach out to you to confirm your eligibility.';
|
|
142
|
+
_formValuesCopy.privateInvestorList = true;
|
|
143
|
+
_formValuesCopy.privateInvestorListDisabled = true;
|
|
144
|
+
}
|
|
145
|
+
if (user.isSubscribed) {
|
|
146
|
+
_formValuesCopy.mailingList = true;
|
|
147
|
+
_formValuesCopy.mailingListText = 'You already subscribed to the email notification list.';
|
|
148
|
+
_formValuesCopy.mailingListDisabled = true;
|
|
149
|
+
}
|
|
150
|
+
setformValues(_formValuesCopy);
|
|
151
|
+
}
|
|
152
|
+
}, [user, checkboxes]);
|
|
153
|
+
var fecthCheckboxes = /*#__PURE__*/function () {
|
|
154
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
155
|
+
var response;
|
|
156
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
157
|
+
while (1) switch (_context.prev = _context.next) {
|
|
158
|
+
case 0:
|
|
159
|
+
_context.prev = 0;
|
|
160
|
+
_context.next = 3;
|
|
161
|
+
return (0, _fetchDataPublic.default)('compliance/get-checkbox-group', {
|
|
162
|
+
group: 'newVentureModal'
|
|
163
|
+
});
|
|
164
|
+
case 3:
|
|
165
|
+
response = _context.sent;
|
|
166
|
+
if (response != null) {
|
|
167
|
+
setcheckboxes(response);
|
|
168
|
+
}
|
|
169
|
+
_context.next = 10;
|
|
170
|
+
break;
|
|
171
|
+
case 7:
|
|
172
|
+
_context.prev = 7;
|
|
173
|
+
_context.t0 = _context["catch"](0);
|
|
174
|
+
console.log('🚀 ~ file: NewVentureModal.js:111 ~ error:', _context.t0);
|
|
175
|
+
case 10:
|
|
176
|
+
case "end":
|
|
177
|
+
return _context.stop();
|
|
178
|
+
}
|
|
179
|
+
}, _callee, null, [[0, 7]]);
|
|
180
|
+
}));
|
|
181
|
+
return function fecthCheckboxes() {
|
|
182
|
+
return _ref.apply(this, arguments);
|
|
183
|
+
};
|
|
184
|
+
}();
|
|
185
|
+
var validationSchema = Yup.object().shape({
|
|
186
|
+
email: Yup.string().matches(_globalVariables.emailRegex, "Oops, that's not a valid address").required('Oops, this can‘t be blank'),
|
|
187
|
+
name: Yup.string().required('Oops, this can‘t be blank')
|
|
188
|
+
});
|
|
189
|
+
var onSubmitButton = /*#__PURE__*/function () {
|
|
190
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(values) {
|
|
191
|
+
var project, dataToSend, response, userCopy, _error$response, _error$response$data, errorParsed;
|
|
192
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
193
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
194
|
+
case 0:
|
|
195
|
+
project = props.project;
|
|
196
|
+
dataToSend = {
|
|
197
|
+
email: values.email,
|
|
198
|
+
projectId: project._id,
|
|
199
|
+
name: values.name,
|
|
200
|
+
checkedCheckboxes: checkedCheckboxes,
|
|
201
|
+
salesChannel: salesChannel
|
|
202
|
+
};
|
|
203
|
+
setisActionLoading(true);
|
|
204
|
+
_context2.prev = 3;
|
|
205
|
+
if (values.privateInvestorList && !formValues.privateInvestorListDisabled) {
|
|
206
|
+
dataToSend.createPrivateInvestor = true;
|
|
207
|
+
}
|
|
208
|
+
if (values.mailingList && !formValues.mailingListDisabled) {
|
|
209
|
+
dataToSend.subscribeToProject = true;
|
|
210
|
+
}
|
|
211
|
+
_context2.next = 8;
|
|
212
|
+
return (0, _fetchDataPublic.default)('private-investor/public/create', dataToSend);
|
|
213
|
+
case 8:
|
|
214
|
+
response = _context2.sent;
|
|
215
|
+
setSuccessMessage(successMsg ? successMsg : "An account manager will reach out to you with further details on the offering and the investment procedure.");
|
|
216
|
+
userCopy = _objectSpread({}, user);
|
|
217
|
+
if (!userCopy.email) {
|
|
218
|
+
//add email and username when subscribing without being logged in
|
|
219
|
+
userCopy.email = values.email;
|
|
220
|
+
userCopy.username = values.name;
|
|
221
|
+
}
|
|
222
|
+
if (response !== null && response !== void 0 && response.privateInvestor) {
|
|
223
|
+
userCopy.privateInvestorStatus = response.privateInvestor.status;
|
|
224
|
+
}
|
|
225
|
+
if (response !== null && response !== void 0 && response.subscribedToProject) {
|
|
226
|
+
userCopy.isSubscribed = true;
|
|
227
|
+
}
|
|
228
|
+
setUser(userCopy);
|
|
229
|
+
_context2.next = 21;
|
|
230
|
+
break;
|
|
231
|
+
case 17:
|
|
232
|
+
_context2.prev = 17;
|
|
233
|
+
_context2.t0 = _context2["catch"](3);
|
|
234
|
+
console.log('🚀 ~ error', _context2.t0);
|
|
235
|
+
//show error message from BE only for 406 error
|
|
236
|
+
if ((_context2.t0 === null || _context2.t0 === void 0 || (_error$response = _context2.t0.response) === null || _error$response === void 0 ? void 0 : _error$response.status) === 406) {
|
|
237
|
+
errorParsed = (_error$response$data = _context2.t0.response.data) === null || _error$response$data === void 0 ? void 0 : _error$response$data.substring(7);
|
|
238
|
+
seterrorMessage(errorMsg ? errorMsg : errorParsed);
|
|
239
|
+
} else {
|
|
240
|
+
seterrorMessage( /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, "Something went wrong. Please try again a bit later or contact us at", ' ', /*#__PURE__*/_react.default.createElement("a", {
|
|
241
|
+
href: "mailto:support@stokr.io",
|
|
242
|
+
style: {
|
|
243
|
+
color: 'inherit'
|
|
244
|
+
}
|
|
245
|
+
}, "support@stokr.io"), ' '));
|
|
246
|
+
}
|
|
247
|
+
case 21:
|
|
248
|
+
_context2.prev = 21;
|
|
249
|
+
setisActionLoading(false);
|
|
250
|
+
return _context2.finish(21);
|
|
251
|
+
case 24:
|
|
252
|
+
case "end":
|
|
253
|
+
return _context2.stop();
|
|
254
|
+
}
|
|
255
|
+
}, _callee2, null, [[3, 17, 21, 24]]);
|
|
256
|
+
}));
|
|
257
|
+
return function onSubmitButton(_x) {
|
|
258
|
+
return _ref2.apply(this, arguments);
|
|
259
|
+
};
|
|
260
|
+
}();
|
|
261
|
+
return /*#__PURE__*/_react.default.createElement(_Modal.Modal, {
|
|
262
|
+
isOpen: isModalOpen,
|
|
263
|
+
onClose: function onClose() {
|
|
264
|
+
setformValues(function (prevState) {
|
|
265
|
+
return _objectSpread(_objectSpread({}, prevState), {}, {
|
|
266
|
+
mailingList: false,
|
|
267
|
+
privateInvestorList: false,
|
|
268
|
+
optionalCheckBox: false
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
onModalClose();
|
|
272
|
+
}
|
|
273
|
+
}, /*#__PURE__*/_react.default.createElement(_Grid.Row, null, /*#__PURE__*/_react.default.createElement(_Grid.Column, {
|
|
274
|
+
part: 8
|
|
275
|
+
}, /*#__PURE__*/_react.default.createElement(_Modal.ModalInner, {
|
|
276
|
+
modalTop: true
|
|
277
|
+
}, /*#__PURE__*/_react.default.createElement(_Text.default, null, /*#__PURE__*/_react.default.createElement("h3", null, errorMessage ? 'OOPS..' : successMessage ? 'AWESOME!' : title), !(successMessage || errorMessage) && /*#__PURE__*/_react.default.createElement("p", null, description))), /*#__PURE__*/_react.default.createElement(_Modal.ModalInner, {
|
|
278
|
+
modalBot: true
|
|
279
|
+
}, modalBotContent)), /*#__PURE__*/_react.default.createElement(_Grid.Column, {
|
|
280
|
+
part: 8
|
|
281
|
+
}, /*#__PURE__*/_react.default.createElement(_Modal.ModalInner, null, successMessage || errorMessage ? /*#__PURE__*/_react.default.createElement(_Text.default, null, /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement("br", null), /*#__PURE__*/_react.default.createElement("p", null, errorMessage ? errorMessage : successMessage)) : /*#__PURE__*/_react.default.createElement(_formik.Formik, {
|
|
282
|
+
initialValues: formValues,
|
|
283
|
+
validationSchema: validationSchema,
|
|
284
|
+
onSubmit: function onSubmit(values) {
|
|
285
|
+
onFormSend(values);
|
|
286
|
+
onSubmitButton(values);
|
|
287
|
+
},
|
|
288
|
+
id: "register-interest-form"
|
|
289
|
+
}, function (_ref3) {
|
|
290
|
+
var values = _ref3.values,
|
|
291
|
+
errors = _ref3.errors,
|
|
292
|
+
touched = _ref3.touched,
|
|
293
|
+
handleBlur = _ref3.handleBlur,
|
|
294
|
+
handleChange = _ref3.handleChange,
|
|
295
|
+
setFieldValue = _ref3.setFieldValue,
|
|
296
|
+
setFieldTouched = _ref3.setFieldTouched;
|
|
297
|
+
var onChangeWithTouch = function onChangeWithTouch(e) {
|
|
298
|
+
var field = e.target;
|
|
299
|
+
setFieldValue(field.name, field.value, false);
|
|
300
|
+
setFieldTouched(field.name);
|
|
301
|
+
};
|
|
302
|
+
var oneOfCheckbox = values.mailingList && !formValues.mailingListDisabled || values.privateInvestorList;
|
|
303
|
+
var optionalCheckBox = formValues.optionalCheckBox ? values.optionalCheckBoxChecked : true;
|
|
304
|
+
if (formValues.email && !values.email) {
|
|
305
|
+
setFieldValue('email', formValues.email);
|
|
306
|
+
setFieldTouched('email');
|
|
307
|
+
}
|
|
308
|
+
if (formValues.name && !values.name) {
|
|
309
|
+
setFieldValue('name', formValues.name);
|
|
310
|
+
setFieldTouched('name');
|
|
311
|
+
}
|
|
312
|
+
if (formValues.mailingList && !values.mailingList) {
|
|
313
|
+
setFieldValue('mailingList', formValues.mailingList);
|
|
314
|
+
}
|
|
315
|
+
if (formValues.privateInvestorList && !values.privateInvestorList) {
|
|
316
|
+
setFieldValue('privateInvestorList', formValues.privateInvestorList);
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
//create custom handleCheckboxChange to add the checkbox to the checkedCheckboxes array
|
|
320
|
+
var handleCheckboxChange = function handleCheckboxChange(e) {
|
|
321
|
+
handleChange(e);
|
|
322
|
+
|
|
323
|
+
//we set id of the checkbox to be the same string as checkbox label, so we can identify the checkbox
|
|
324
|
+
if (e.target.checked) {
|
|
325
|
+
setcheckedCheckboxes([].concat(_toConsumableArray(checkedCheckboxes), [e.target.id]));
|
|
326
|
+
} else {
|
|
327
|
+
setcheckedCheckboxes(checkedCheckboxes.filter(function (item) {
|
|
328
|
+
return item !== e.target.id;
|
|
329
|
+
}));
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
var submitDisabled = !touched.email || !!errors.email || !touched.name || !!errors.name || isActionLoading || !oneOfCheckbox || !optionalCheckBox;
|
|
333
|
+
return /*#__PURE__*/_react.default.createElement(_Form.default, null, /*#__PURE__*/_react.default.createElement(_ComponentWrapper.default, {
|
|
334
|
+
noPadding: true
|
|
335
|
+
}, /*#__PURE__*/_react.default.createElement(_Form.FormField, null, !user && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
336
|
+
id: "new-venture-email",
|
|
337
|
+
name: "email",
|
|
338
|
+
type: "email",
|
|
339
|
+
label: "Your email",
|
|
340
|
+
value: values.email,
|
|
341
|
+
onChange: onChangeWithTouch,
|
|
342
|
+
onBlur: handleBlur,
|
|
343
|
+
error: !!errors.email,
|
|
344
|
+
touched: !!touched.email
|
|
345
|
+
}), /*#__PURE__*/_react.default.createElement(_Form.FormError, {
|
|
346
|
+
show: touched.email && errors.email
|
|
347
|
+
}, errors.email), /*#__PURE__*/_react.default.createElement(_ComponentWrapper.default, {
|
|
348
|
+
noPaddingHorizontal: true,
|
|
349
|
+
paddingVeticalHalf: true,
|
|
350
|
+
noPaddingBottom: true
|
|
351
|
+
}, /*#__PURE__*/_react.default.createElement(_Input.default, {
|
|
352
|
+
id: "new-venture-name",
|
|
353
|
+
name: "name",
|
|
354
|
+
type: "text",
|
|
355
|
+
label: "Your name",
|
|
356
|
+
value: values.name,
|
|
357
|
+
onChange: onChangeWithTouch,
|
|
358
|
+
onBlur: handleBlur,
|
|
359
|
+
error: !!errors.name,
|
|
360
|
+
touched: !!touched.name
|
|
361
|
+
}), /*#__PURE__*/_react.default.createElement(_Form.FormError, {
|
|
362
|
+
show: touched.name && errors.name
|
|
363
|
+
}, errors.name))), /*#__PURE__*/_react.default.createElement(_Form.FormField, {
|
|
364
|
+
style: {
|
|
365
|
+
marginTop: '1rem',
|
|
366
|
+
marginBottom: -5
|
|
367
|
+
}
|
|
368
|
+
}, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
369
|
+
id: 'createPrivateInvestor' //same as checkbox label
|
|
370
|
+
,
|
|
371
|
+
name: "privateInvestorList",
|
|
372
|
+
text: formValues.privateInvestorListText,
|
|
373
|
+
checked: values.privateInvestorList,
|
|
374
|
+
disabled: formValues.privateInvestorListDisabled,
|
|
375
|
+
onChange: handleCheckboxChange,
|
|
376
|
+
onBlur: handleBlur
|
|
377
|
+
})), /*#__PURE__*/_react.default.createElement(_Form.FormField, {
|
|
378
|
+
style: {
|
|
379
|
+
marginTop: '2rem',
|
|
380
|
+
marginBottom: -5
|
|
381
|
+
}
|
|
382
|
+
}, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
383
|
+
id: "subscribeToProject",
|
|
384
|
+
name: "mailingList",
|
|
385
|
+
text: formValues.mailingListText,
|
|
386
|
+
checked: values.mailingList,
|
|
387
|
+
disabled: formValues.mailingListDisabled,
|
|
388
|
+
onChange: handleCheckboxChange,
|
|
389
|
+
onBlur: handleBlur
|
|
390
|
+
})), formValues.optionalCheckBox && /*#__PURE__*/_react.default.createElement(_Form.FormField, {
|
|
391
|
+
style: {
|
|
392
|
+
marginTop: '2rem',
|
|
393
|
+
marginBottom: -5
|
|
394
|
+
}
|
|
395
|
+
}, /*#__PURE__*/_react.default.createElement(_Checkbox.default, {
|
|
396
|
+
id: "optionalCheckBox",
|
|
397
|
+
name: "optionalCheckBoxChecked",
|
|
398
|
+
text: formValues.optionalCheckBoxText,
|
|
399
|
+
value: values.optionalCheckBoxChecked,
|
|
400
|
+
checked: values.optionalCheckBoxChecked,
|
|
401
|
+
onChange: handleChange,
|
|
402
|
+
onBlur: handleBlur
|
|
403
|
+
})), project.type === _globalVariables.ProjectTypes.FUND && /*#__PURE__*/_react.default.createElement(_Form.FormField, {
|
|
404
|
+
style: {
|
|
405
|
+
marginTop: '2rem',
|
|
406
|
+
marginBottom: -5
|
|
407
|
+
}
|
|
408
|
+
}, /*#__PURE__*/_react.default.createElement("p", {
|
|
409
|
+
style: {
|
|
410
|
+
margin: 0,
|
|
411
|
+
fontSize: 12
|
|
412
|
+
}
|
|
413
|
+
}, /*#__PURE__*/_react.default.createElement("strong", null, "The fund, as well as its fund manager(s) and affiliates, may not be subject to any registration or other local marketing or private placement laws in your jurisdiction."))))), /*#__PURE__*/_react.default.createElement(_ComponentWrapper.default, {
|
|
414
|
+
noPaddingBottom: true,
|
|
415
|
+
noPaddingHorizontal: true,
|
|
416
|
+
center: true
|
|
417
|
+
}, /*#__PURE__*/_react.default.createElement(_Button.default, {
|
|
418
|
+
type: "submit",
|
|
419
|
+
id: "private-investor-subscribe-button",
|
|
420
|
+
disabled: submitDisabled // fluid
|
|
421
|
+
}, "register")), /*#__PURE__*/_react.default.createElement(_ComponentWrapper.default, {
|
|
422
|
+
paddingVeticalHalf: true,
|
|
423
|
+
noPaddingHorizontal: true
|
|
424
|
+
}, /*#__PURE__*/_react.default.createElement(_Form.FormError, {
|
|
425
|
+
show: popupError
|
|
426
|
+
}, popupError)));
|
|
427
|
+
})))));
|
|
428
|
+
});
|
|
429
|
+
exports.NewVentureModal = NewVentureModal;
|
|
430
|
+
NewVentureModal.propTypes = {
|
|
431
|
+
isModalOpen: _propTypes.default.bool.isRequired,
|
|
432
|
+
onModalClose: _propTypes.default.func.isRequired,
|
|
433
|
+
onFormSend: _propTypes.default.func.isRequired,
|
|
434
|
+
onModalSwitch: _propTypes.default.func,
|
|
435
|
+
title: _propTypes.default.string,
|
|
436
|
+
description: _propTypes.default.string,
|
|
437
|
+
popupError: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.node]),
|
|
438
|
+
project: _propTypes.default.object,
|
|
439
|
+
successMsg: _propTypes.default.node,
|
|
440
|
+
errorMsg: _propTypes.default.node,
|
|
441
|
+
modalBotContent: _propTypes.default.node
|
|
442
|
+
};
|
|
443
|
+
NewVentureModal.defaultProps = {
|
|
444
|
+
title: 'Register Your Interest',
|
|
445
|
+
description: 'Join us in this exciting investment opportunity.',
|
|
446
|
+
popupError: null,
|
|
447
|
+
project: {
|
|
448
|
+
_id: '',
|
|
449
|
+
name: '',
|
|
450
|
+
type: 'fund',
|
|
451
|
+
title: '',
|
|
452
|
+
description: ''
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
var _default = NewVentureModal;
|
|
456
|
+
exports.default = _default;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = exports.WithTokenProject = exports.WithLongDescription = exports.WithError = exports.WithCustomTitle = exports.Interactive = exports.EquityProject = exports.Default = void 0;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _NewVentureModal = require("./NewVentureModal");
|
|
10
|
+
var _global = _interopRequireDefault(require("../../../styles/global"));
|
|
11
|
+
var _AuthContext = require("../../../context/AuthContext");
|
|
12
|
+
var _reactRouterDom = require("react-router-dom");
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
15
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
16
|
+
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; }
|
|
17
|
+
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; }
|
|
18
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
20
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
21
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
22
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
23
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
24
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
25
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
26
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
27
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
28
|
+
var _default = {
|
|
29
|
+
title: 'Components Library/Modal/NewVentureModal',
|
|
30
|
+
component: _NewVentureModal.NewVentureModal,
|
|
31
|
+
parameters: {
|
|
32
|
+
docs: {
|
|
33
|
+
description: {
|
|
34
|
+
component: 'A modal component for new venture registration with form validation, checkbox management, and user authentication integration.'
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
argTypes: {
|
|
39
|
+
isModalOpen: {
|
|
40
|
+
control: 'boolean'
|
|
41
|
+
},
|
|
42
|
+
title: {
|
|
43
|
+
control: 'text'
|
|
44
|
+
},
|
|
45
|
+
description: {
|
|
46
|
+
control: 'text'
|
|
47
|
+
},
|
|
48
|
+
popupError: {
|
|
49
|
+
control: 'text'
|
|
50
|
+
},
|
|
51
|
+
project: {
|
|
52
|
+
control: 'object'
|
|
53
|
+
},
|
|
54
|
+
successMsg: {
|
|
55
|
+
control: 'text'
|
|
56
|
+
},
|
|
57
|
+
errorMsg: {
|
|
58
|
+
control: 'text'
|
|
59
|
+
},
|
|
60
|
+
modalBotContent: {
|
|
61
|
+
control: 'text'
|
|
62
|
+
},
|
|
63
|
+
onModalClose: {
|
|
64
|
+
action: 'modal closed'
|
|
65
|
+
},
|
|
66
|
+
onFormSend: {
|
|
67
|
+
action: 'form submitted'
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}; // Sample project data
|
|
71
|
+
exports.default = _default;
|
|
72
|
+
var sampleProject = {
|
|
73
|
+
_id: 'project-123',
|
|
74
|
+
name: 'aquarius',
|
|
75
|
+
type: 'fund',
|
|
76
|
+
title: 'Aquarius Fund',
|
|
77
|
+
description: 'A revolutionary investment opportunity in sustainable technology.'
|
|
78
|
+
};
|
|
79
|
+
var sampleTokenProject = {
|
|
80
|
+
_id: 'project-456',
|
|
81
|
+
name: 'tech-token',
|
|
82
|
+
type: 'token',
|
|
83
|
+
title: 'Tech Token',
|
|
84
|
+
description: 'Invest in the future of technology with our innovative token offering.'
|
|
85
|
+
};
|
|
86
|
+
var Template = function Template(args) {
|
|
87
|
+
var _useState = (0, _react.useState)(args.isModalOpen || false),
|
|
88
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
89
|
+
isOpen = _useState2[0],
|
|
90
|
+
setIsOpen = _useState2[1];
|
|
91
|
+
var handleModalClose = function handleModalClose() {
|
|
92
|
+
var _args$onModalClose;
|
|
93
|
+
setIsOpen(false);
|
|
94
|
+
(_args$onModalClose = args.onModalClose) === null || _args$onModalClose === void 0 || _args$onModalClose.call(args);
|
|
95
|
+
};
|
|
96
|
+
var handleFormSend = function handleFormSend(values) {
|
|
97
|
+
var _args$onFormSend;
|
|
98
|
+
console.log('Form submitted with values:', values);
|
|
99
|
+
(_args$onFormSend = args.onFormSend) === null || _args$onFormSend === void 0 || _args$onFormSend.call(args, values);
|
|
100
|
+
};
|
|
101
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_global.default, null), /*#__PURE__*/_react.default.createElement("button", {
|
|
102
|
+
onClick: function onClick() {
|
|
103
|
+
return setIsOpen(true);
|
|
104
|
+
},
|
|
105
|
+
style: {
|
|
106
|
+
padding: '10px 20px'
|
|
107
|
+
}
|
|
108
|
+
}, "Open New Venture Modal"), /*#__PURE__*/_react.default.createElement(_reactRouterDom.BrowserRouter, null, /*#__PURE__*/_react.default.createElement(_AuthContext.AuthProvider, null, /*#__PURE__*/_react.default.createElement(_NewVentureModal.NewVentureModal, _extends({}, args, {
|
|
109
|
+
isModalOpen: isOpen,
|
|
110
|
+
onModalClose: handleModalClose,
|
|
111
|
+
onFormSend: handleFormSend
|
|
112
|
+
})))));
|
|
113
|
+
};
|
|
114
|
+
var Default = Template.bind({});
|
|
115
|
+
exports.Default = Default;
|
|
116
|
+
Default.args = {
|
|
117
|
+
title: 'Register Your Interest',
|
|
118
|
+
description: 'Join us in this exciting investment opportunity. Fill out the form below to get started.',
|
|
119
|
+
project: sampleProject,
|
|
120
|
+
popupError: null
|
|
121
|
+
};
|
|
122
|
+
var WithTokenProject = Template.bind({});
|
|
123
|
+
exports.WithTokenProject = WithTokenProject;
|
|
124
|
+
WithTokenProject.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
125
|
+
project: sampleTokenProject,
|
|
126
|
+
title: 'Token Investment Opportunity',
|
|
127
|
+
description: 'Get early access to our innovative token offering.'
|
|
128
|
+
});
|
|
129
|
+
var WithError = Template.bind({});
|
|
130
|
+
exports.WithError = WithError;
|
|
131
|
+
WithError.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
132
|
+
popupError: 'This email is already registered. Please try a different email address.'
|
|
133
|
+
});
|
|
134
|
+
var WithCustomTitle = Template.bind({});
|
|
135
|
+
exports.WithCustomTitle = WithCustomTitle;
|
|
136
|
+
WithCustomTitle.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
137
|
+
title: 'Join the Innovation Revolution',
|
|
138
|
+
description: 'Be part of the next big thing in sustainable technology investments.'
|
|
139
|
+
});
|
|
140
|
+
var WithLongDescription = Template.bind({});
|
|
141
|
+
exports.WithLongDescription = WithLongDescription;
|
|
142
|
+
WithLongDescription.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
143
|
+
title: 'Comprehensive Investment Opportunity',
|
|
144
|
+
description: 'This is a detailed description of the investment opportunity that provides comprehensive information about the project, its goals, potential returns, and the team behind it. Investors can learn about the technology, market potential, and strategic vision.'
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// Interactive example with form submission handling
|
|
148
|
+
var Interactive = Template.bind({});
|
|
149
|
+
exports.Interactive = Interactive;
|
|
150
|
+
Interactive.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
151
|
+
onFormSend: function onFormSend(values) {
|
|
152
|
+
console.log('Interactive form submitted:', values);
|
|
153
|
+
alert("Form submitted successfully!\nEmail: ".concat(values.email, "\nName: ").concat(values.name, "\nPrivate Investor: ").concat(values.privateInvestorList, "\nMailing List: ").concat(values.mailingList));
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Example with different project types
|
|
158
|
+
var EquityProject = Template.bind({});
|
|
159
|
+
exports.EquityProject = EquityProject;
|
|
160
|
+
EquityProject.args = _objectSpread(_objectSpread({}, Default.args), {}, {
|
|
161
|
+
project: {
|
|
162
|
+
_id: 'project-789',
|
|
163
|
+
name: 'startup-equity',
|
|
164
|
+
type: 'equity',
|
|
165
|
+
title: 'Startup Equity Investment',
|
|
166
|
+
description: 'Invest in early-stage startup with high growth potential.'
|
|
167
|
+
},
|
|
168
|
+
title: 'Equity Investment Opportunity',
|
|
169
|
+
description: 'Get equity in a promising startup and be part of their growth journey.'
|
|
170
|
+
});
|
package/dist/index.js
CHANGED
|
@@ -630,6 +630,17 @@ Object.keys(_PaymentModal).forEach(function (key) {
|
|
|
630
630
|
}
|
|
631
631
|
});
|
|
632
632
|
});
|
|
633
|
+
var _NewVentureModal = require("./components/Modal/NewVentureModal/NewVentureModal");
|
|
634
|
+
Object.keys(_NewVentureModal).forEach(function (key) {
|
|
635
|
+
if (key === "default" || key === "__esModule") return;
|
|
636
|
+
if (key in exports && exports[key] === _NewVentureModal[key]) return;
|
|
637
|
+
Object.defineProperty(exports, key, {
|
|
638
|
+
enumerable: true,
|
|
639
|
+
get: function get() {
|
|
640
|
+
return _NewVentureModal[key];
|
|
641
|
+
}
|
|
642
|
+
});
|
|
643
|
+
});
|
|
633
644
|
var _MultiProgressBar = require("./components/MultiProgressBar/MultiProgressBar");
|
|
634
645
|
Object.keys(_MultiProgressBar).forEach(function (key) {
|
|
635
646
|
if (key === "default" || key === "__esModule") return;
|
package/dist/styles/colors.js
CHANGED