@stokr/components-library 2.2.0 → 2.2.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.
- package/dist/components/Checklist/UserChecklist.js +1 -1
- package/dist/components/FAQ/FAQ.js +2 -2
- package/dist/components/FAQ/FAQ.stories.js +6 -0
- package/dist/components/Footer/mangopay.svg +20 -20
- package/dist/components/Icon/Icon.style.js +5 -1
- package/dist/index.js +11 -0
- package/dist/utils/analytics.js +60 -0
- package/package.json +2 -1
- package/dist/components/NotificationContext/NotificationContext.stories.js +0 -33
- package/dist/components/ProfileHeader/ProfileHeader-CLb4.js +0 -477
- package/dist/components/RegisterLiquidSteps/RegisterLiquidSteps.stories.js +0 -66
- package/dist/components/TermsModal/PrivacyText.js +0 -359
- package/dist/components/context/Auth.js +0 -207
- package/dist/components/context/AuthContext.js +0 -334
- package/dist/utils/breakpoint.js +0 -19
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _axios = _interopRequireDefault(require("../../model/axios"));
|
|
8
|
-
var _jsCookie = _interopRequireDefault(require("js-cookie"));
|
|
9
|
-
var _getCookieDomain = _interopRequireDefault(require("../../utils/get-cookie-domain"));
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
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); }
|
|
12
|
-
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; }
|
|
13
|
-
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); } }
|
|
14
|
-
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); }); }; }
|
|
15
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
16
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
17
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
18
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
19
|
-
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); }
|
|
20
|
-
var Auth = /*#__PURE__*/function () {
|
|
21
|
-
function Auth() {
|
|
22
|
-
_classCallCheck(this, Auth);
|
|
23
|
-
}
|
|
24
|
-
_createClass(Auth, null, [{
|
|
25
|
-
key: "setAccessToken",
|
|
26
|
-
value: function setAccessToken(token) {
|
|
27
|
-
this.logout();
|
|
28
|
-
var inOneHour = 1 / 24;
|
|
29
|
-
var cookieOptions = {
|
|
30
|
-
expires: inOneHour
|
|
31
|
-
};
|
|
32
|
-
if (process.env.NODE_ENV === 'production') {
|
|
33
|
-
cookieOptions.domain = (0, _getCookieDomain.default)();
|
|
34
|
-
}
|
|
35
|
-
_jsCookie.default.set('STOKR_ACCESS_TOKEN', token, cookieOptions);
|
|
36
|
-
}
|
|
37
|
-
}, {
|
|
38
|
-
key: "getAccessToken",
|
|
39
|
-
value: function getAccessToken() {
|
|
40
|
-
return _jsCookie.default.get('STOKR_ACCESS_TOKEN');
|
|
41
|
-
}
|
|
42
|
-
}, {
|
|
43
|
-
key: "logout",
|
|
44
|
-
value: function logout() {
|
|
45
|
-
var cookieDomain = {};
|
|
46
|
-
if (process.env.NODE_ENV === 'production') {
|
|
47
|
-
cookieDomain.domain = (0, _getCookieDomain.default)();
|
|
48
|
-
}
|
|
49
|
-
_jsCookie.default.remove('STOKR_ACCESS_TOKEN', cookieDomain);
|
|
50
|
-
}
|
|
51
|
-
}, {
|
|
52
|
-
key: "login",
|
|
53
|
-
value: function login(data) {
|
|
54
|
-
return new Promise(function (resolve, reject) {
|
|
55
|
-
_axios.default.post("auth/login", data).then(function (response) {
|
|
56
|
-
_axios.default.defaults.headers.common.Authorization = "Bearer ".concat(response.data.access_token);
|
|
57
|
-
resolve(response.data);
|
|
58
|
-
}).catch(function (err) {
|
|
59
|
-
reject(err);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
}, {
|
|
64
|
-
key: "twoFactor",
|
|
65
|
-
value: function twoFactor(data) {
|
|
66
|
-
return new Promise(function (resolve, reject) {
|
|
67
|
-
_axios.default.post("auth/confirm2fa", data).then(function (response) {
|
|
68
|
-
resolve(response.data);
|
|
69
|
-
}).catch(function (err) {
|
|
70
|
-
reject(err);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
}, {
|
|
75
|
-
key: "activateUser",
|
|
76
|
-
value: function activateUser() {
|
|
77
|
-
var isUsingQueryParam = window.location.href.includes('?token=');
|
|
78
|
-
var token;
|
|
79
|
-
if (isUsingQueryParam) {
|
|
80
|
-
token = window.location.href.split('activateUser?token=')[1].split('&')[0];
|
|
81
|
-
} else {
|
|
82
|
-
token = window.location.href.split('activateUser/')[1].split('/')[0];
|
|
83
|
-
}
|
|
84
|
-
return new Promise(function (resolve, reject) {
|
|
85
|
-
_axios.default.post("auth/activate", {
|
|
86
|
-
token: token
|
|
87
|
-
}).then(function (response) {
|
|
88
|
-
resolve(response.data);
|
|
89
|
-
}).catch(function (err) {
|
|
90
|
-
reject(err);
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}, {
|
|
95
|
-
key: "getUser",
|
|
96
|
-
value: function getUser() {
|
|
97
|
-
return new Promise(function (resolve, reject) {
|
|
98
|
-
_axios.default.post("user/get").then(function (response) {
|
|
99
|
-
resolve(response.data);
|
|
100
|
-
}).catch(function (err) {
|
|
101
|
-
reject(err);
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
}, {
|
|
106
|
-
key: "checkPrivateInvestor",
|
|
107
|
-
value: function checkPrivateInvestor(data) {
|
|
108
|
-
return new Promise(function (resolve, reject) {
|
|
109
|
-
_axios.default.post("private-investor/check", data).then(function (response) {
|
|
110
|
-
resolve(response.data);
|
|
111
|
-
}).catch(function (err) {
|
|
112
|
-
reject(err);
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}, {
|
|
117
|
-
key: "updateUser",
|
|
118
|
-
value: function updateUser(data) {
|
|
119
|
-
return new Promise(function (resolve, reject) {
|
|
120
|
-
_axios.default.post("user/updateProfile", data).then(function (response) {
|
|
121
|
-
resolve(response.data);
|
|
122
|
-
}).catch(function (err) {
|
|
123
|
-
reject(err);
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}, {
|
|
128
|
-
key: "sendWelcomeEmail",
|
|
129
|
-
value: function sendWelcomeEmail() {
|
|
130
|
-
return new Promise(function (resolve, reject) {
|
|
131
|
-
_axios.default.post("user/welcomeEmail").then(function () {
|
|
132
|
-
resolve();
|
|
133
|
-
}).catch(function (err) {
|
|
134
|
-
reject(err);
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
}, {
|
|
139
|
-
key: "resendActivationEmail",
|
|
140
|
-
value: function resendActivationEmail(data) {
|
|
141
|
-
return new Promise(function (resolve, reject) {
|
|
142
|
-
_axios.default.post("auth/forgotPass", data).then(function () {
|
|
143
|
-
resolve();
|
|
144
|
-
}).catch(function (err) {
|
|
145
|
-
reject(err);
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}, {
|
|
150
|
-
key: "uploaProofOfAddress",
|
|
151
|
-
value: function uploaProofOfAddress(data, ip) {
|
|
152
|
-
return new Promise( /*#__PURE__*/function () {
|
|
153
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(resolve, reject) {
|
|
154
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
155
|
-
while (1) switch (_context.prev = _context.next) {
|
|
156
|
-
case 0:
|
|
157
|
-
_axios.default.post("https://kycdocs.stokr-staging.de/kyc/upload?ip=".concat(ip), data, {
|
|
158
|
-
headers: {
|
|
159
|
-
'Content-Type': 'multipart/form-data'
|
|
160
|
-
}
|
|
161
|
-
}).then(function (response) {
|
|
162
|
-
resolve(response.data);
|
|
163
|
-
}).catch(function (err) {
|
|
164
|
-
reject(err);
|
|
165
|
-
});
|
|
166
|
-
case 1:
|
|
167
|
-
case "end":
|
|
168
|
-
return _context.stop();
|
|
169
|
-
}
|
|
170
|
-
}, _callee);
|
|
171
|
-
}));
|
|
172
|
-
return function (_x, _x2) {
|
|
173
|
-
return _ref.apply(this, arguments);
|
|
174
|
-
};
|
|
175
|
-
}());
|
|
176
|
-
}
|
|
177
|
-
}, {
|
|
178
|
-
key: "validateGreenWalletId",
|
|
179
|
-
value: function validateGreenWalletId(id) {
|
|
180
|
-
return new Promise( /*#__PURE__*/function () {
|
|
181
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(resolve, reject) {
|
|
182
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
183
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
184
|
-
case 0:
|
|
185
|
-
_axios.default.post("greenwallet/validate-gaid", {
|
|
186
|
-
gaid: id
|
|
187
|
-
}).then(function (response) {
|
|
188
|
-
resolve(response.data);
|
|
189
|
-
}).catch(function (err) {
|
|
190
|
-
reject(err);
|
|
191
|
-
});
|
|
192
|
-
case 1:
|
|
193
|
-
case "end":
|
|
194
|
-
return _context2.stop();
|
|
195
|
-
}
|
|
196
|
-
}, _callee2);
|
|
197
|
-
}));
|
|
198
|
-
return function (_x3, _x4) {
|
|
199
|
-
return _ref2.apply(this, arguments);
|
|
200
|
-
};
|
|
201
|
-
}());
|
|
202
|
-
}
|
|
203
|
-
}]);
|
|
204
|
-
return Auth;
|
|
205
|
-
}();
|
|
206
|
-
var _default = Auth;
|
|
207
|
-
exports.default = _default;
|
|
@@ -1,334 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.AuthProvider = exports.AuthContext = exports.AuthConsumer = void 0;
|
|
7
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
var _axios = _interopRequireDefault(require("../../model/axios"));
|
|
10
|
-
var _Auth = _interopRequireDefault(require("./Auth"));
|
|
11
|
-
var _withRouter = require("../../utils/withRouter");
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
-
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); }
|
|
14
|
-
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; }
|
|
15
|
-
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); }
|
|
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 _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; }
|
|
19
|
-
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); } }
|
|
20
|
-
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); }); }; }
|
|
21
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
22
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
23
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
24
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
25
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
26
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
27
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
28
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
29
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
30
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
31
|
-
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; }
|
|
32
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
33
|
-
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); }
|
|
34
|
-
var AuthContext = /*#__PURE__*/_react.default.createContext();
|
|
35
|
-
exports.AuthContext = AuthContext;
|
|
36
|
-
var AuthProviderClass = /*#__PURE__*/function (_Component) {
|
|
37
|
-
_inherits(AuthProviderClass, _Component);
|
|
38
|
-
var _super = _createSuper(AuthProviderClass);
|
|
39
|
-
function AuthProviderClass() {
|
|
40
|
-
var _this;
|
|
41
|
-
_classCallCheck(this, AuthProviderClass);
|
|
42
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
43
|
-
args[_key] = arguments[_key];
|
|
44
|
-
}
|
|
45
|
-
_this = _super.call.apply(_super, [this].concat(args));
|
|
46
|
-
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
47
|
-
user: undefined,
|
|
48
|
-
isFetchingUser: true
|
|
49
|
-
});
|
|
50
|
-
_defineProperty(_assertThisInitialized(_this), "activateUser", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
51
|
-
var _yield$Auth$activateU, user, access_token;
|
|
52
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
53
|
-
while (1) switch (_context.prev = _context.next) {
|
|
54
|
-
case 0:
|
|
55
|
-
_context.prev = 0;
|
|
56
|
-
_context.next = 3;
|
|
57
|
-
return _Auth.default.activateUser();
|
|
58
|
-
case 3:
|
|
59
|
-
_yield$Auth$activateU = _context.sent;
|
|
60
|
-
user = _yield$Auth$activateU.user;
|
|
61
|
-
access_token = _yield$Auth$activateU.access_token;
|
|
62
|
-
_axios.default.defaults.headers.common.Authorization = "Bearer ".concat(access_token);
|
|
63
|
-
_Auth.default.setAccessToken(access_token);
|
|
64
|
-
_this.setState({
|
|
65
|
-
user: user,
|
|
66
|
-
isFetchingUser: false
|
|
67
|
-
});
|
|
68
|
-
_context.next = 16;
|
|
69
|
-
break;
|
|
70
|
-
case 11:
|
|
71
|
-
_context.prev = 11;
|
|
72
|
-
_context.t0 = _context["catch"](0);
|
|
73
|
-
console.log('Error activating user: ', _context.t0);
|
|
74
|
-
_this.props.navigate('/oops', {
|
|
75
|
-
state: {
|
|
76
|
-
message: 'This activation token has expired.',
|
|
77
|
-
hasActivationTokenExpired: true
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
_this.setState({
|
|
81
|
-
isFetchingUser: false
|
|
82
|
-
});
|
|
83
|
-
case 16:
|
|
84
|
-
case "end":
|
|
85
|
-
return _context.stop();
|
|
86
|
-
}
|
|
87
|
-
}, _callee, null, [[0, 11]]);
|
|
88
|
-
})));
|
|
89
|
-
_defineProperty(_assertThisInitialized(_this), "logoutUser", function () {
|
|
90
|
-
_Auth.default.logout();
|
|
91
|
-
_this.setState({
|
|
92
|
-
user: undefined
|
|
93
|
-
});
|
|
94
|
-
window.location.href = "https://".concat(process.env.REACT_APP_WEBSITE_DOMAIN);
|
|
95
|
-
});
|
|
96
|
-
_defineProperty(_assertThisInitialized(_this), "setUser", /*#__PURE__*/function () {
|
|
97
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(accessToken) {
|
|
98
|
-
var _yield$Auth$getUser, user;
|
|
99
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
100
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
101
|
-
case 0:
|
|
102
|
-
_axios.default.defaults.headers.common.Authorization = "Bearer ".concat(accessToken);
|
|
103
|
-
_context2.prev = 1;
|
|
104
|
-
_context2.next = 4;
|
|
105
|
-
return _Auth.default.getUser();
|
|
106
|
-
case 4:
|
|
107
|
-
_yield$Auth$getUser = _context2.sent;
|
|
108
|
-
user = _yield$Auth$getUser.user;
|
|
109
|
-
_this.setState({
|
|
110
|
-
user: user,
|
|
111
|
-
isFetchingUser: false
|
|
112
|
-
});
|
|
113
|
-
_context2.next = 14;
|
|
114
|
-
break;
|
|
115
|
-
case 9:
|
|
116
|
-
_context2.prev = 9;
|
|
117
|
-
_context2.t0 = _context2["catch"](1);
|
|
118
|
-
_this.props.navigate('/oops');
|
|
119
|
-
_this.setState({
|
|
120
|
-
isFetchingUser: false
|
|
121
|
-
});
|
|
122
|
-
console.log("Error fetching the user: ".concat(_context2.t0));
|
|
123
|
-
case 14:
|
|
124
|
-
case "end":
|
|
125
|
-
return _context2.stop();
|
|
126
|
-
}
|
|
127
|
-
}, _callee2, null, [[1, 9]]);
|
|
128
|
-
}));
|
|
129
|
-
return function (_x) {
|
|
130
|
-
return _ref2.apply(this, arguments);
|
|
131
|
-
};
|
|
132
|
-
}());
|
|
133
|
-
_defineProperty(_assertThisInitialized(_this), "updateUser", /*#__PURE__*/function () {
|
|
134
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data) {
|
|
135
|
-
var _yield$Auth$updateUse, user;
|
|
136
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
137
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
138
|
-
case 0:
|
|
139
|
-
_context3.prev = 0;
|
|
140
|
-
_context3.next = 3;
|
|
141
|
-
return _Auth.default.updateUser(data);
|
|
142
|
-
case 3:
|
|
143
|
-
_yield$Auth$updateUse = _context3.sent;
|
|
144
|
-
user = _yield$Auth$updateUse.user;
|
|
145
|
-
_this.setState({
|
|
146
|
-
user: user
|
|
147
|
-
});
|
|
148
|
-
_context3.next = 12;
|
|
149
|
-
break;
|
|
150
|
-
case 8:
|
|
151
|
-
_context3.prev = 8;
|
|
152
|
-
_context3.t0 = _context3["catch"](0);
|
|
153
|
-
console.log("Error updating the user: ".concat(_context3.t0));
|
|
154
|
-
throw _context3.t0;
|
|
155
|
-
case 12:
|
|
156
|
-
case "end":
|
|
157
|
-
return _context3.stop();
|
|
158
|
-
}
|
|
159
|
-
}, _callee3, null, [[0, 8]]);
|
|
160
|
-
}));
|
|
161
|
-
return function (_x2) {
|
|
162
|
-
return _ref3.apply(this, arguments);
|
|
163
|
-
};
|
|
164
|
-
}());
|
|
165
|
-
_defineProperty(_assertThisInitialized(_this), "checkIfPrivateInvestor", /*#__PURE__*/function () {
|
|
166
|
-
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(data) {
|
|
167
|
-
var result;
|
|
168
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
169
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
170
|
-
case 0:
|
|
171
|
-
_context4.prev = 0;
|
|
172
|
-
_context4.next = 3;
|
|
173
|
-
return _Auth.default.checkPrivateInvestor(data);
|
|
174
|
-
case 3:
|
|
175
|
-
result = _context4.sent;
|
|
176
|
-
return _context4.abrupt("return", result);
|
|
177
|
-
case 7:
|
|
178
|
-
_context4.prev = 7;
|
|
179
|
-
_context4.t0 = _context4["catch"](0);
|
|
180
|
-
throw _context4.t0;
|
|
181
|
-
case 10:
|
|
182
|
-
case "end":
|
|
183
|
-
return _context4.stop();
|
|
184
|
-
}
|
|
185
|
-
}, _callee4, null, [[0, 7]]);
|
|
186
|
-
}));
|
|
187
|
-
return function (_x3) {
|
|
188
|
-
return _ref4.apply(this, arguments);
|
|
189
|
-
};
|
|
190
|
-
}());
|
|
191
|
-
_defineProperty(_assertThisInitialized(_this), "resendActivationEmail", /*#__PURE__*/function () {
|
|
192
|
-
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(data) {
|
|
193
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
194
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
195
|
-
case 0:
|
|
196
|
-
_context5.prev = 0;
|
|
197
|
-
_context5.next = 3;
|
|
198
|
-
return _Auth.default.resendActivationEmail(data);
|
|
199
|
-
case 3:
|
|
200
|
-
_context5.next = 9;
|
|
201
|
-
break;
|
|
202
|
-
case 5:
|
|
203
|
-
_context5.prev = 5;
|
|
204
|
-
_context5.t0 = _context5["catch"](0);
|
|
205
|
-
console.log("Error resending activation email: ".concat(_context5.t0));
|
|
206
|
-
throw _context5.t0;
|
|
207
|
-
case 9:
|
|
208
|
-
case "end":
|
|
209
|
-
return _context5.stop();
|
|
210
|
-
}
|
|
211
|
-
}, _callee5, null, [[0, 5]]);
|
|
212
|
-
}));
|
|
213
|
-
return function (_x4) {
|
|
214
|
-
return _ref5.apply(this, arguments);
|
|
215
|
-
};
|
|
216
|
-
}());
|
|
217
|
-
_defineProperty(_assertThisInitialized(_this), "sendWelcomeEmail", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
218
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
219
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
220
|
-
case 0:
|
|
221
|
-
_context6.prev = 0;
|
|
222
|
-
_context6.next = 3;
|
|
223
|
-
return _Auth.default.sendWelcomeEmail();
|
|
224
|
-
case 3:
|
|
225
|
-
_context6.next = 8;
|
|
226
|
-
break;
|
|
227
|
-
case 5:
|
|
228
|
-
_context6.prev = 5;
|
|
229
|
-
_context6.t0 = _context6["catch"](0);
|
|
230
|
-
console.log("Error sending welcome email: ".concat(_context6.t0));
|
|
231
|
-
// No need to throw error, let the app continue even if it fails
|
|
232
|
-
case 8:
|
|
233
|
-
case "end":
|
|
234
|
-
return _context6.stop();
|
|
235
|
-
}
|
|
236
|
-
}, _callee6, null, [[0, 5]]);
|
|
237
|
-
})));
|
|
238
|
-
_defineProperty(_assertThisInitialized(_this), "uploaProofOfAddress", /*#__PURE__*/function () {
|
|
239
|
-
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(data, ip) {
|
|
240
|
-
var user;
|
|
241
|
-
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
242
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
243
|
-
case 0:
|
|
244
|
-
_context7.prev = 0;
|
|
245
|
-
_context7.next = 3;
|
|
246
|
-
return _Auth.default.uploaProofOfAddress(data, ip);
|
|
247
|
-
case 3:
|
|
248
|
-
user = _context7.sent;
|
|
249
|
-
_this.setState({
|
|
250
|
-
user: user
|
|
251
|
-
});
|
|
252
|
-
_context7.next = 11;
|
|
253
|
-
break;
|
|
254
|
-
case 7:
|
|
255
|
-
_context7.prev = 7;
|
|
256
|
-
_context7.t0 = _context7["catch"](0);
|
|
257
|
-
console.log("Error uploading proof of address: ".concat(_context7.t0));
|
|
258
|
-
throw _context7.t0;
|
|
259
|
-
case 11:
|
|
260
|
-
case "end":
|
|
261
|
-
return _context7.stop();
|
|
262
|
-
}
|
|
263
|
-
}, _callee7, null, [[0, 7]]);
|
|
264
|
-
}));
|
|
265
|
-
return function (_x5, _x6) {
|
|
266
|
-
return _ref7.apply(this, arguments);
|
|
267
|
-
};
|
|
268
|
-
}());
|
|
269
|
-
_defineProperty(_assertThisInitialized(_this), "validateGreenWalletId", /*#__PURE__*/function () {
|
|
270
|
-
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(id) {
|
|
271
|
-
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
272
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
273
|
-
case 0:
|
|
274
|
-
_context8.prev = 0;
|
|
275
|
-
return _context8.abrupt("return", _Auth.default.validateGreenWalletId(id));
|
|
276
|
-
case 4:
|
|
277
|
-
_context8.prev = 4;
|
|
278
|
-
_context8.t0 = _context8["catch"](0);
|
|
279
|
-
console.log("Error validating Green Wallet ID: ".concat(_context8.t0));
|
|
280
|
-
throw _context8.t0;
|
|
281
|
-
case 8:
|
|
282
|
-
case "end":
|
|
283
|
-
return _context8.stop();
|
|
284
|
-
}
|
|
285
|
-
}, _callee8, null, [[0, 4]]);
|
|
286
|
-
}));
|
|
287
|
-
return function (_x7) {
|
|
288
|
-
return _ref8.apply(this, arguments);
|
|
289
|
-
};
|
|
290
|
-
}());
|
|
291
|
-
return _this;
|
|
292
|
-
}
|
|
293
|
-
_createClass(AuthProviderClass, [{
|
|
294
|
-
key: "componentDidMount",
|
|
295
|
-
value: function componentDidMount() {
|
|
296
|
-
var isActivatingUser = window.location.href.includes('/activateUser');
|
|
297
|
-
var accessToken = _Auth.default.getAccessToken();
|
|
298
|
-
if (isActivatingUser) {
|
|
299
|
-
this.activateUser();
|
|
300
|
-
} else if (accessToken) {
|
|
301
|
-
this.setUser(accessToken);
|
|
302
|
-
} else {
|
|
303
|
-
console.log('No access token');
|
|
304
|
-
window.location.href = "https://".concat(process.env.REACT_APP_WEBSITE_DOMAIN, "/login");
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}, {
|
|
308
|
-
key: "render",
|
|
309
|
-
value: function render() {
|
|
310
|
-
var children = this.props.children;
|
|
311
|
-
return /*#__PURE__*/_react.default.createElement(AuthContext.Provider, {
|
|
312
|
-
value: _objectSpread(_objectSpread({}, this.state), {}, {
|
|
313
|
-
logoutUser: this.logoutUser,
|
|
314
|
-
setUser: this.setUser,
|
|
315
|
-
updateUser: this.updateUser,
|
|
316
|
-
checkIfPrivateInvestor: this.checkIfPrivateInvestor,
|
|
317
|
-
sendWelcomeEmail: this.sendWelcomeEmail,
|
|
318
|
-
resendActivationEmail: this.resendActivationEmail,
|
|
319
|
-
uploaProofOfAddress: this.uploaProofOfAddress,
|
|
320
|
-
validateGreenWalletId: this.validateGreenWalletId
|
|
321
|
-
})
|
|
322
|
-
}, children);
|
|
323
|
-
}
|
|
324
|
-
}]);
|
|
325
|
-
return AuthProviderClass;
|
|
326
|
-
}(_react.Component);
|
|
327
|
-
AuthProviderClass.propTypes = {
|
|
328
|
-
children: _propTypes.default.node.isRequired
|
|
329
|
-
};
|
|
330
|
-
var AuthConsumer = AuthContext.Consumer;
|
|
331
|
-
exports.AuthConsumer = AuthConsumer;
|
|
332
|
-
var AuthProvider = (0, _withRouter.withRouter)(AuthProviderClass);
|
|
333
|
-
//export default AuthProvider
|
|
334
|
-
exports.AuthProvider = AuthProvider;
|
package/dist/utils/breakpoint.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.config = exports.breakpoint = void 0;
|
|
7
|
-
var _styledBreakpoints = require("styled-breakpoints");
|
|
8
|
-
var config = {
|
|
9
|
-
mobile: '450px',
|
|
10
|
-
tablet: '768px',
|
|
11
|
-
desktop: '992px',
|
|
12
|
-
lgDesktop: '1020px',
|
|
13
|
-
highDesktop: '1920px'
|
|
14
|
-
};
|
|
15
|
-
exports.config = config;
|
|
16
|
-
var breakpoint = (0, _styledBreakpoints.createTheme)(config);
|
|
17
|
-
exports.breakpoint = breakpoint;
|
|
18
|
-
var _default = breakpoint;
|
|
19
|
-
exports.default = _default;
|