authscape 1.0.94 → 1.0.98

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.
Files changed (2) hide show
  1. package/index.js +1277 -1277
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,1277 +1,1277 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.Datatable = void 0;
9
-
10
- var _react = _interopRequireWildcard(require("react"));
11
-
12
- var _reactDataTableComponent = _interopRequireWildcard(require("react-data-table-component"));
13
-
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
-
16
- 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; }
17
-
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
19
-
20
- 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); } }
21
-
22
- 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); }); }; }
23
-
24
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
-
26
- 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, descriptor.key, descriptor); } }
27
-
28
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
29
-
30
- 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); }
31
-
32
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
-
34
- 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); }; }
35
-
36
- 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); }
37
-
38
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
-
40
- 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; } }
41
-
42
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
-
44
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
45
-
46
- var Datatable = /*#__PURE__*/function (_Component) {
47
- _inherits(Datatable, _Component);
48
-
49
- var _super = _createSuper(Datatable);
50
-
51
- function Datatable(props) {
52
- var _this;
53
-
54
- _classCallCheck(this, Datatable);
55
-
56
- _this = _super.call(this, props);
57
-
58
- _defineProperty(_assertThisInitialized(_this), "componentDidMount", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
59
- return _regeneratorRuntime().wrap(function _callee$(_context) {
60
- while (1) {
61
- switch (_context.prev = _context.next) {
62
- case 0:
63
- _context.next = 2;
64
- return _this.GetDataFromUrl(_this.state.pageNumber, _this.state.pageLength, _this.props.params);
65
-
66
- case 2:
67
- (0, _reactDataTableComponent.createTheme)('dataTable', {
68
- text: {}
69
- });
70
-
71
- case 3:
72
- case "end":
73
- return _context.stop();
74
- }
75
- }
76
- }, _callee);
77
- })));
78
-
79
- _defineProperty(_assertThisInitialized(_this), "reload", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
80
- var reset,
81
- _args3 = arguments;
82
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
83
- while (1) {
84
- switch (_context3.prev = _context3.next) {
85
- case 0:
86
- reset = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : false;
87
-
88
- if (!(reset === true)) {
89
- _context3.next = 5;
90
- break;
91
- }
92
-
93
- _this.setState({
94
- pageNumber: 1
95
- }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
96
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
97
- while (1) {
98
- switch (_context2.prev = _context2.next) {
99
- case 0:
100
- _context2.next = 2;
101
- return _this.GetDataFromUrl(_this.state.pageNumber, _this.state.pageLength, _this.props.params);
102
-
103
- case 2:
104
- case "end":
105
- return _context2.stop();
106
- }
107
- }
108
- }, _callee2);
109
- })));
110
-
111
- _context3.next = 7;
112
- break;
113
-
114
- case 5:
115
- _context3.next = 7;
116
- return _this.GetDataFromUrl(_this.state.pageNumber, _this.state.pageLength, _this.props.params);
117
-
118
- case 7:
119
- case "end":
120
- return _context3.stop();
121
- }
122
- }
123
- }, _callee3);
124
- })));
125
-
126
- _defineProperty(_assertThisInitialized(_this), "GetDataFromUrl", function (page, length) {
127
- var postData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
128
-
129
- _this.setState({
130
- loading: true
131
- }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
132
- var data, response;
133
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
134
- while (1) {
135
- switch (_context4.prev = _context4.next) {
136
- case 0:
137
- data = postData;
138
- data.offset = page;
139
- data.length = length;
140
- response = null;
141
-
142
- if (!(this.props.methodType == "get")) {
143
- _context4.next = 10;
144
- break;
145
- }
146
-
147
- _context4.next = 7;
148
- return apiService().get(this.props.url);
149
-
150
- case 7:
151
- response = _context4.sent;
152
- _context4.next = 13;
153
- break;
154
-
155
- case 10:
156
- _context4.next = 12;
157
- return apiService().post(this.props.url, postData);
158
-
159
- case 12:
160
- response = _context4.sent;
161
-
162
- case 13:
163
- if (response != null && response.status === 200) {
164
- if (this.props.returnResult != null) {
165
- this.props.returnResult(response.data.data);
166
- }
167
-
168
- this.setState({
169
- totalRows: response.data.recordsTotal,
170
- data: response.data.data,
171
- loading: false
172
- });
173
- } else {//console.error(response.status + " - " + response.data);
174
- }
175
-
176
- case 14:
177
- case "end":
178
- return _context4.stop();
179
- }
180
- }
181
- }, _callee4, this);
182
- })));
183
- });
184
-
185
- _defineProperty(_assertThisInitialized(_this), "handlePageChange", /*#__PURE__*/function () {
186
- var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(page) {
187
- var pageLength;
188
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
189
- while (1) {
190
- switch (_context5.prev = _context5.next) {
191
- case 0:
192
- pageLength = _this.state.pageLength;
193
-
194
- _this.setState({
195
- pageNumber: page
196
- });
197
-
198
- _context5.next = 4;
199
- return _this.GetDataFromUrl(page, pageLength, _this.props.params);
200
-
201
- case 4:
202
- case "end":
203
- return _context5.stop();
204
- }
205
- }
206
- }, _callee5);
207
- }));
208
-
209
- return function (_x) {
210
- return _ref5.apply(this, arguments);
211
- };
212
- }());
213
-
214
- _this.state = {
215
- pageNumber: 1,
216
- pageLength: props.pageLength ? props.pageLength : 10,
217
- data: [],
218
- loading: false,
219
- totalRows: 0
220
- };
221
- return _this;
222
- }
223
-
224
- _createClass(Datatable, [{
225
- key: "render",
226
- value: function render() {
227
- return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_reactDataTableComponent["default"], {
228
- title: this.props.title,
229
- columns: this.props.columns,
230
- data: this.state.data,
231
- paginationRowsPerPageOptions: this.props.pageLength ? [this.props.pageLength] : [10],
232
- progressPending: this.state.loading,
233
- customStyles: this.props.customStyles,
234
- paginationPerPage: this.props.pageLength ? this.props.pageLength : 10,
235
- paginationServer: true,
236
- pagination: true,
237
- paginationTotalRows: this.state.totalRows // onChangeRowsPerPage={this.handlePerRowsChange}
238
- ,
239
- onChangePage: this.handlePageChange,
240
- noDataComponent: this.props.noDataComponent
241
- }));
242
- }
243
- }]);
244
-
245
- return Datatable;
246
- }(_react.Component);
247
-
248
- exports.Datatable = Datatable;
249
-
250
- _defineProperty(Datatable, "defaultProps", {
251
- options: {}
252
- });
253
- "use strict";
254
-
255
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
256
-
257
- Object.defineProperty(exports, "__esModule", {
258
- value: true
259
- });
260
- exports["default"] = void 0;
261
-
262
- var _react = _interopRequireWildcard(require("react"));
263
-
264
- 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); }
265
-
266
- 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; }
267
-
268
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
269
-
270
- 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, descriptor.key, descriptor); } }
271
-
272
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
273
-
274
- 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); }
275
-
276
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
277
-
278
- 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); }; }
279
-
280
- 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); }
281
-
282
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
283
-
284
- 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; } }
285
-
286
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
287
-
288
- var DummyComponent = /*#__PURE__*/function (_Component) {
289
- _inherits(DummyComponent, _Component);
290
-
291
- var _super = _createSuper(DummyComponent);
292
-
293
- function DummyComponent() {
294
- _classCallCheck(this, DummyComponent);
295
-
296
- return _super.apply(this, arguments);
297
- }
298
-
299
- _createClass(DummyComponent, [{
300
- key: "render",
301
- value: function render() {
302
- return /*#__PURE__*/_react["default"].createElement("div", null, "I am a dummy react npm module");
303
- }
304
- }]);
305
-
306
- return DummyComponent;
307
- }(_react.Component);
308
-
309
- exports["default"] = DummyComponent;
310
- "use strict";
311
-
312
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
313
-
314
- Object.defineProperty(exports, "__esModule", {
315
- value: true
316
- });
317
- exports.apiService = void 0;
318
-
319
- var _axios = _interopRequireDefault(require("axios"));
320
-
321
- var _queryString = _interopRequireDefault(require("query-string"));
322
-
323
- var _jsFileDownload = _interopRequireDefault(require("js-file-download"));
324
-
325
- var _nookies = require("nookies");
326
-
327
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
328
-
329
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
330
-
331
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
332
-
333
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
334
-
335
- 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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
336
-
337
- 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); } }
338
-
339
- 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); }); }; }
340
-
341
- var setupDefaultOptions = /*#__PURE__*/function () {
342
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
343
- var ctx,
344
- defaultOptions,
345
- accessToken,
346
- _args = arguments;
347
- return _regeneratorRuntime().wrap(function _callee$(_context) {
348
- while (1) {
349
- switch (_context.prev = _context.next) {
350
- case 0:
351
- ctx = _args.length > 0 && _args[0] !== undefined ? _args[0] : null;
352
- defaultOptions = {};
353
-
354
- if (ctx == null) {
355
- accessToken = (0, _nookies.parseCookies)().access_token || '';
356
-
357
- if (accessToken !== null && accessToken !== undefined && accessToken != "") {
358
- defaultOptions = {
359
- headers: {
360
- Authorization: "Bearer " + accessToken
361
- }
362
- };
363
- } else {
364
- defaultOptions = {
365
- headers: {}
366
- };
367
- }
368
- } else {
369
- defaultOptions = {
370
- headers: {}
371
- };
372
- }
373
-
374
- return _context.abrupt("return", defaultOptions);
375
-
376
- case 4:
377
- case "end":
378
- return _context.stop();
379
- }
380
- }
381
- }, _callee);
382
- }));
383
-
384
- return function setupDefaultOptions() {
385
- return _ref.apply(this, arguments);
386
- };
387
- }();
388
-
389
- var RefreshToken = /*#__PURE__*/function () {
390
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(originalRequest, instance) {
391
- var accessToken, refreshToken, response;
392
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
393
- while (1) {
394
- switch (_context2.prev = _context2.next) {
395
- case 0:
396
- accessToken = (0, _nookies.parseCookies)().access_token || '';
397
- refreshToken = (0, _nookies.parseCookies)().refresh_token || '';
398
- _context2.next = 4;
399
- return instance.post(process.env.AUTHORITYURI + "/connect/token", _queryString["default"].stringify({
400
- grant_type: 'refresh_token',
401
- client_id: process.env.client_id,
402
- client_secret: process.env.client_secret,
403
- refresh_token: refreshToken
404
- }), {
405
- headers: {
406
- "Content-Type": "application/x-www-form-urlencoded",
407
- "Authorization": "Bearer " + accessToken
408
- }
409
- });
410
-
411
- case 4:
412
- response = _context2.sent;
413
-
414
- if (!(response != null && response.status == 200)) {
415
- _context2.next = 13;
416
- break;
417
- }
418
-
419
- originalRequest.headers['Authorization'] = 'Bearer ' + response.data.access_token;
420
- _context2.next = 9;
421
- return (0, _nookies.setCookie)(null, "access_token", response.data.access_token, {
422
- maxAge: 2147483647,
423
- path: '/',
424
- domain: process.env.cookieDomain,
425
- secure: true
426
- });
427
-
428
- case 9:
429
- _context2.next = 11;
430
- return (0, _nookies.setCookie)(null, "expires_in", response.data.expires_in, {
431
- maxAge: 2147483647,
432
- path: '/',
433
- domain: process.env.cookieDomain,
434
- secure: true
435
- });
436
-
437
- case 11:
438
- _context2.next = 13;
439
- return (0, _nookies.setCookie)(null, "refresh_token", response.data.refresh_token, {
440
- maxAge: 2147483647,
441
- path: '/',
442
- domain: process.env.cookieDomain,
443
- secure: true
444
- });
445
-
446
- case 13:
447
- case "end":
448
- return _context2.stop();
449
- }
450
- }
451
- }, _callee2);
452
- }));
453
-
454
- return function RefreshToken(_x, _x2) {
455
- return _ref2.apply(this, arguments);
456
- };
457
- }();
458
-
459
- var apiService = function apiService() {
460
- var ctx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
461
- var env = process.env.STAGE;
462
-
463
- if (env == "development") {
464
- process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
465
- }
466
-
467
- var baseUri = process.env.APIURI + "/api";
468
-
469
- var instance = _axios["default"].create({
470
- baseURL: baseUri,
471
- //timeout: 10000,
472
- params: {} // do not remove this, its added to add params later in the config
473
-
474
- });
475
-
476
- instance.interceptors.response.use(function (response) {
477
- return response;
478
- }, /*#__PURE__*/function () {
479
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(error) {
480
- var originalConfig;
481
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
482
- while (1) {
483
- switch (_context3.prev = _context3.next) {
484
- case 0:
485
- originalConfig = error.config;
486
-
487
- if (!error.response) {
488
- _context3.next = 10;
489
- break;
490
- }
491
-
492
- if (!(error.response.status === 401 && !originalConfig._retry)) {
493
- _context3.next = 7;
494
- break;
495
- }
496
-
497
- originalConfig._retry = true; // Do something, call refreshToken() request for example;
498
-
499
- _context3.next = 6;
500
- return RefreshToken(originalConfig, instance);
501
-
502
- case 6:
503
- return _context3.abrupt("return", instance.request(originalConfig));
504
-
505
- case 7:
506
- if (!(error.response.status === 400)) {
507
- _context3.next = 10;
508
- break;
509
- }
510
-
511
- // Do something
512
- if (error.response.config.url.includes("/connect/token")) // remove the access and refresh if invalid
513
- {
514
- (0, _nookies.destroyCookie)(null, "access_token", {
515
- maxAge: 2147483647,
516
- path: '/',
517
- domain: process.env.cookieDomain
518
- });
519
- (0, _nookies.destroyCookie)(null, "refresh_token", {
520
- maxAge: 2147483647,
521
- path: '/',
522
- domain: process.env.cookieDomain
523
- });
524
- (0, _nookies.destroyCookie)(null, "expires_in", {
525
- maxAge: 2147483647,
526
- path: '/',
527
- domain: process.env.cookieDomain
528
- });
529
- }
530
-
531
- return _context3.abrupt("return", Promise.reject(error));
532
-
533
- case 10:
534
- return _context3.abrupt("return", Promise.reject(error));
535
-
536
- case 11:
537
- case "end":
538
- return _context3.stop();
539
- }
540
- }
541
- }, _callee3);
542
- }));
543
-
544
- return function (_x3) {
545
- return _ref3.apply(this, arguments);
546
- };
547
- }());
548
- return {
549
- get: function () {
550
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(url) {
551
- var options,
552
- defaultOptions,
553
- _args4 = arguments;
554
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
555
- while (1) {
556
- switch (_context4.prev = _context4.next) {
557
- case 0:
558
- options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
559
- _context4.prev = 1;
560
- _context4.next = 4;
561
- return setupDefaultOptions(ctx);
562
-
563
- case 4:
564
- defaultOptions = _context4.sent;
565
- _context4.next = 7;
566
- return instance.get(url, _objectSpread(_objectSpread({}, defaultOptions), options));
567
-
568
- case 7:
569
- return _context4.abrupt("return", _context4.sent);
570
-
571
- case 10:
572
- _context4.prev = 10;
573
- _context4.t0 = _context4["catch"](1);
574
- return _context4.abrupt("return", _context4.t0.response);
575
-
576
- case 13:
577
- case "end":
578
- return _context4.stop();
579
- }
580
- }
581
- }, _callee4, null, [[1, 10]]);
582
- }));
583
-
584
- function get(_x4) {
585
- return _get.apply(this, arguments);
586
- }
587
-
588
- return get;
589
- }(),
590
- post: function () {
591
- var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(url, data) {
592
- var options,
593
- defaultOptions,
594
- _args5 = arguments;
595
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
596
- while (1) {
597
- switch (_context5.prev = _context5.next) {
598
- case 0:
599
- options = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : {};
600
- _context5.prev = 1;
601
- _context5.next = 4;
602
- return setupDefaultOptions(ctx);
603
-
604
- case 4:
605
- defaultOptions = _context5.sent;
606
- _context5.next = 7;
607
- return instance.post(url, data, _objectSpread(_objectSpread({}, defaultOptions), options));
608
-
609
- case 7:
610
- return _context5.abrupt("return", _context5.sent);
611
-
612
- case 10:
613
- _context5.prev = 10;
614
- _context5.t0 = _context5["catch"](1);
615
- return _context5.abrupt("return", _context5.t0.response);
616
-
617
- case 13:
618
- case "end":
619
- return _context5.stop();
620
- }
621
- }
622
- }, _callee5, null, [[1, 10]]);
623
- }));
624
-
625
- function post(_x5, _x6) {
626
- return _post.apply(this, arguments);
627
- }
628
-
629
- return post;
630
- }(),
631
- put: function () {
632
- var _put = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(url, data) {
633
- var options,
634
- defaultOptions,
635
- _args6 = arguments;
636
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
637
- while (1) {
638
- switch (_context6.prev = _context6.next) {
639
- case 0:
640
- options = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : {};
641
- _context6.prev = 1;
642
- _context6.next = 4;
643
- return setupDefaultOptions(ctx);
644
-
645
- case 4:
646
- defaultOptions = _context6.sent;
647
- _context6.next = 7;
648
- return instance.put(url, data, _objectSpread(_objectSpread({}, defaultOptions), options));
649
-
650
- case 7:
651
- return _context6.abrupt("return", _context6.sent);
652
-
653
- case 10:
654
- _context6.prev = 10;
655
- _context6.t0 = _context6["catch"](1);
656
- return _context6.abrupt("return", _context6.t0.response);
657
-
658
- case 13:
659
- case "end":
660
- return _context6.stop();
661
- }
662
- }
663
- }, _callee6, null, [[1, 10]]);
664
- }));
665
-
666
- function put(_x7, _x8) {
667
- return _put.apply(this, arguments);
668
- }
669
-
670
- return put;
671
- }(),
672
- "delete": function () {
673
- var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(url) {
674
- var options,
675
- defaultOptions,
676
- _args7 = arguments;
677
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
678
- while (1) {
679
- switch (_context7.prev = _context7.next) {
680
- case 0:
681
- options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
682
- _context7.prev = 1;
683
- _context7.next = 4;
684
- return setupDefaultOptions(ctx);
685
-
686
- case 4:
687
- defaultOptions = _context7.sent;
688
- _context7.next = 7;
689
- return instance["delete"](url, _objectSpread(_objectSpread({}, defaultOptions), options));
690
-
691
- case 7:
692
- return _context7.abrupt("return", _context7.sent);
693
-
694
- case 10:
695
- _context7.prev = 10;
696
- _context7.t0 = _context7["catch"](1);
697
- return _context7.abrupt("return", _context7.t0.response);
698
-
699
- case 13:
700
- case "end":
701
- return _context7.stop();
702
- }
703
- }
704
- }, _callee7, null, [[1, 10]]);
705
- }));
706
-
707
- function _delete(_x9) {
708
- return _delete2.apply(this, arguments);
709
- }
710
-
711
- return _delete;
712
- }(),
713
- GetCurrentUser: function () {
714
- var _GetCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
715
- var accessToken, defaultOptions, response;
716
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
717
- while (1) {
718
- switch (_context8.prev = _context8.next) {
719
- case 0:
720
- _context8.prev = 0;
721
- accessToken = (0, _nookies.parseCookies)().access_token || null;
722
-
723
- if (!accessToken) {
724
- _context8.next = 11;
725
- break;
726
- }
727
-
728
- _context8.next = 5;
729
- return setupDefaultOptions(null);
730
-
731
- case 5:
732
- defaultOptions = _context8.sent;
733
- _context8.next = 8;
734
- return instance.get('/UserManagement', defaultOptions);
735
-
736
- case 8:
737
- response = _context8.sent;
738
-
739
- if (!(response != null && response.status == 200)) {
740
- _context8.next = 11;
741
- break;
742
- }
743
-
744
- return _context8.abrupt("return", response.data);
745
-
746
- case 11:
747
- _context8.next = 16;
748
- break;
749
-
750
- case 13:
751
- _context8.prev = 13;
752
- _context8.t0 = _context8["catch"](0);
753
- //return -1;
754
- console.log(_context8.t0.message);
755
-
756
- case 16:
757
- return _context8.abrupt("return", null);
758
-
759
- case 17:
760
- case "end":
761
- return _context8.stop();
762
- }
763
- }
764
- }, _callee8, null, [[0, 13]]);
765
- }));
766
-
767
- function GetCurrentUser() {
768
- return _GetCurrentUser.apply(this, arguments);
769
- }
770
-
771
- return GetCurrentUser;
772
- }(),
773
- DownloadFile: function () {
774
- var _DownloadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(url, fileName, completed) {
775
- var defaultOptions, options, response;
776
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
777
- while (1) {
778
- switch (_context9.prev = _context9.next) {
779
- case 0:
780
- _context9.prev = 0;
781
- //let defaultOptions = await setupDefaultOptions();
782
- defaultOptions = {};
783
- options = {
784
- responseType: "blob"
785
- };
786
- _context9.next = 5;
787
- return instance.get(url, _objectSpread(_objectSpread({}, defaultOptions), options));
788
-
789
- case 5:
790
- response = _context9.sent;
791
-
792
- if (response.status === 200) {
793
- (0, _jsFileDownload["default"])(response.data, fileName);
794
-
795
- if (completed !== undefined) {
796
- completed();
797
- }
798
- }
799
-
800
- _context9.next = 13;
801
- break;
802
-
803
- case 9:
804
- _context9.prev = 9;
805
- _context9.t0 = _context9["catch"](0);
806
- console.error(_context9.t0);
807
-
808
- if (completed !== undefined) {
809
- completed();
810
- }
811
-
812
- case 13:
813
- case "end":
814
- return _context9.stop();
815
- }
816
- }
817
- }, _callee9, null, [[0, 9]]);
818
- }));
819
-
820
- function DownloadFile(_x10, _x11, _x12) {
821
- return _DownloadFile.apply(this, arguments);
822
- }
823
-
824
- return DownloadFile;
825
- }()
826
- };
827
- };
828
-
829
- exports.apiService = apiService;
830
- "use strict";
831
-
832
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
833
-
834
- Object.defineProperty(exports, "__esModule", {
835
- value: true
836
- });
837
- exports.AuthorizationComponent = AuthorizationComponent;
838
-
839
- var _react = _interopRequireWildcard(require("react"));
840
-
841
- 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); }
842
-
843
- 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; }
844
-
845
- 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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
846
-
847
- 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); } }
848
-
849
- 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); }); }; }
850
-
851
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
852
-
853
- 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."); }
854
-
855
- 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); }
856
-
857
- 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; }
858
-
859
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
860
-
861
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
862
-
863
- //import apiService from './apiService';
864
- function AuthorizationComponent(_ref) {
865
- var children = _ref.children,
866
- setCurrentUser = _ref.setCurrentUser,
867
- userLoaded = _ref.userLoaded,
868
- isLoading = _ref.isLoading;
869
-
870
- var _useState = (0, _react.useState)(false),
871
- _useState2 = _slicedToArray(_useState, 2),
872
- loaded = _useState2[0],
873
- setLoaded = _useState2[1];
874
-
875
- var validateUserSignedIn = /*#__PURE__*/function () {
876
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
877
- var usr;
878
- return _regeneratorRuntime().wrap(function _callee$(_context) {
879
- while (1) {
880
- switch (_context.prev = _context.next) {
881
- case 0:
882
- setLoaded(true);
883
- _context.next = 3;
884
- return apiService().GetCurrentUser();
885
-
886
- case 3:
887
- usr = _context.sent;
888
-
889
- if (usr != null) {
890
- setCurrentUser(usr);
891
- } else {
892
- setCurrentUser(null);
893
- }
894
-
895
- userLoaded();
896
-
897
- case 6:
898
- case "end":
899
- return _context.stop();
900
- }
901
- }
902
- }, _callee);
903
- }));
904
-
905
- return function validateUserSignedIn() {
906
- return _ref2.apply(this, arguments);
907
- };
908
- }();
909
-
910
- (0, _react.useEffect)(function () {
911
- if (!loaded) {
912
- validateUserSignedIn();
913
- }
914
- }, [loaded]);
915
- return children;
916
- }
917
- "use strict";
918
-
919
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
920
-
921
- Object.defineProperty(exports, "__esModule", {
922
- value: true
923
- });
924
- exports.authService = void 0;
925
-
926
- var _react = _interopRequireDefault(require("react"));
927
-
928
- var _nookies = require("nookies");
929
-
930
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
931
-
932
- 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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
933
-
934
- 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); } }
935
-
936
- 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); }); }; }
937
-
938
- var authService = function authService() {
939
- return {
940
- dec2hex: function dec2hex(dec) {
941
- return ('0' + dec.toString(16)).substr(-2);
942
- },
943
- generateRandomString: function generateRandomString() {
944
- var array = new Uint32Array(56 / 2);
945
- window.crypto.getRandomValues(array);
946
- return Array.from(array, authService().dec2hex).join('');
947
- },
948
- sha256: function sha256(plain) {
949
- var encoder = new TextEncoder();
950
- var data = encoder.encode(plain);
951
- return window.crypto.subtle.digest('SHA-256', data);
952
- },
953
- base64urlencode: function base64urlencode(a) {
954
- var str = "";
955
- var bytes = new Uint8Array(a);
956
- var len = bytes.byteLength;
957
-
958
- for (var i = 0; i < len; i++) {
959
- str += String.fromCharCode(bytes[i]);
960
- }
961
-
962
- return btoa(str).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
963
- },
964
- challenge_from_verifier: function () {
965
- var _challenge_from_verifier = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(v) {
966
- var hashed, base64encoded;
967
- return _regeneratorRuntime().wrap(function _callee$(_context) {
968
- while (1) {
969
- switch (_context.prev = _context.next) {
970
- case 0:
971
- _context.next = 2;
972
- return authService().sha256(v);
973
-
974
- case 2:
975
- hashed = _context.sent;
976
- base64encoded = authService().base64urlencode(hashed);
977
- return _context.abrupt("return", base64encoded);
978
-
979
- case 5:
980
- case "end":
981
- return _context.stop();
982
- }
983
- }
984
- }, _callee);
985
- }));
986
-
987
- function challenge_from_verifier(_x) {
988
- return _challenge_from_verifier.apply(this, arguments);
989
- }
990
-
991
- return challenge_from_verifier;
992
- }(),
993
- login: function () {
994
- var _login = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
995
- var redirectUserUri,
996
- dnsRecord,
997
- deviceId,
998
- state,
999
- verifier,
1000
- challenge,
1001
- redirectUri,
1002
- loginUri,
1003
- _args2 = arguments;
1004
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1005
- while (1) {
1006
- switch (_context2.prev = _context2.next) {
1007
- case 0:
1008
- redirectUserUri = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : null;
1009
- dnsRecord = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : null;
1010
- deviceId = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : null;
1011
- state = "1234";
1012
-
1013
- if (redirectUserUri != null) {
1014
- localStorage.setItem("redirectUri", redirectUserUri);
1015
- }
1016
-
1017
- verifier = authService().generateRandomString();
1018
- _context2.next = 8;
1019
- return authService().challenge_from_verifier(verifier);
1020
-
1021
- case 8:
1022
- challenge = _context2.sent;
1023
- window.localStorage.setItem("verifier", verifier);
1024
- redirectUri = window.location.origin + "/signin-oidc";
1025
- loginUri = process.env.AUTHORITYURI + "/connect/authorize?response_type=code&state=" + state + "&client_id=" + process.env.client_id + "&scope=email%20openid%20offline_access%20profile%20api1&redirect_uri=" + redirectUri + "&code_challenge=" + challenge + "&code_challenge_method=S256";
1026
-
1027
- if (deviceId) {
1028
- loginUri += "&deviceId=" + deviceId; // will be for chrome extention and mobile apps later
1029
- }
1030
-
1031
- window.location.href = loginUri;
1032
-
1033
- case 14:
1034
- case "end":
1035
- return _context2.stop();
1036
- }
1037
- }
1038
- }, _callee2);
1039
- }));
1040
-
1041
- function login() {
1042
- return _login.apply(this, arguments);
1043
- }
1044
-
1045
- return login;
1046
- }(),
1047
- signUp: function signUp() {
1048
- var redirectUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1049
- var AuthUri = process.env.AUTHORITYURI;
1050
- var url = "";
1051
-
1052
- if (redirectUrl == null) {
1053
- url = AuthUri + "/Account/Register?returnUrl=" + window.location.href;
1054
- localStorage.setItem("redirectUri", window.location.href);
1055
- } else {
1056
- url = AuthUri + "/Account/Register?returnUrl=" + redirectUrl;
1057
- localStorage.setItem("redirectUri", redirectUrl);
1058
- }
1059
-
1060
- window.location.href = url;
1061
- },
1062
- logout: function () {
1063
- var _logout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
1064
- var AuthUri, cookieDomain;
1065
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1066
- while (1) {
1067
- switch (_context3.prev = _context3.next) {
1068
- case 0:
1069
- AuthUri = process.env.AUTHORITYURI;
1070
- cookieDomain = process.env.cookieDomain;
1071
- (0, _nookies.destroyCookie)({}, "access_token", {
1072
- maxAge: 2147483647,
1073
- path: '/',
1074
- domain: cookieDomain
1075
- });
1076
- (0, _nookies.destroyCookie)({}, "refresh_token", {
1077
- maxAge: 2147483647,
1078
- path: '/',
1079
- domain: cookieDomain
1080
- });
1081
- (0, _nookies.destroyCookie)({}, "expires_in", {
1082
- maxAge: 2147483647,
1083
- path: '/',
1084
- domain: cookieDomain
1085
- });
1086
- setTimeout(function () {
1087
- window.location.href = AuthUri + "/connect/logout?redirect=" + window.location.href;
1088
- }, 500);
1089
-
1090
- case 6:
1091
- case "end":
1092
- return _context3.stop();
1093
- }
1094
- }
1095
- }, _callee3);
1096
- }));
1097
-
1098
- function logout() {
1099
- return _logout.apply(this, arguments);
1100
- }
1101
-
1102
- return logout;
1103
- }()
1104
- };
1105
- };
1106
-
1107
- exports.authService = authService;
1108
- "use strict";
1109
-
1110
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1111
-
1112
- Object.defineProperty(exports, "__esModule", {
1113
- value: true
1114
- });
1115
- exports.signInValidator = void 0;
1116
-
1117
- var _react = _interopRequireWildcard(require("react"));
1118
-
1119
- var _axios = _interopRequireDefault(require("axios"));
1120
-
1121
- var _queryString = _interopRequireDefault(require("query-string"));
1122
-
1123
- var _nookies = require("nookies");
1124
-
1125
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
1126
-
1127
- 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); }
1128
-
1129
- 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; }
1130
-
1131
- 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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
1132
-
1133
- 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); } }
1134
-
1135
- 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); }); }; }
1136
-
1137
- var signInValidator = /*#__PURE__*/function () {
1138
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(queryCode) {
1139
- var codeVerifier, headers, queryString, response, domain, redirectUri;
1140
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1141
- while (1) {
1142
- switch (_context.prev = _context.next) {
1143
- case 0:
1144
- codeVerifier = window.localStorage.getItem("verifier");
1145
-
1146
- if (!(queryCode != null && codeVerifier != null)) {
1147
- _context.next = 18;
1148
- break;
1149
- }
1150
-
1151
- headers = {
1152
- 'Content-Type': 'application/x-www-form-urlencoded'
1153
- };
1154
- queryString = _queryString["default"].stringify({
1155
- code: queryCode,
1156
- grant_type: "authorization_code",
1157
- redirect_uri: window.location.origin + "/signin-oidc",
1158
- client_id: process.env.client_id,
1159
- client_secret: process.env.client_secret,
1160
- code_verifier: codeVerifier
1161
- });
1162
- _context.next = 6;
1163
- return _axios["default"].post(process.env.AUTHORITYURI + '/connect/token', queryString, {
1164
- headers: headers
1165
- });
1166
-
1167
- case 6:
1168
- response = _context.sent;
1169
- window.localStorage.removeItem("verifier");
1170
- domain = process.env.cookieDomain;
1171
- _context.next = 11;
1172
- return (0, _nookies.setCookie)(null, "access_token", response.data.access_token, {
1173
- maxAge: 2147483647,
1174
- path: '/',
1175
- domain: domain,
1176
- secure: true
1177
- });
1178
-
1179
- case 11:
1180
- _context.next = 13;
1181
- return (0, _nookies.setCookie)(null, "expires_in", response.data.expires_in, {
1182
- maxAge: 2147483647,
1183
- path: '/',
1184
- domain: domain,
1185
- secure: true
1186
- });
1187
-
1188
- case 13:
1189
- _context.next = 15;
1190
- return (0, _nookies.setCookie)(null, "refresh_token", response.data.refresh_token, {
1191
- maxAge: 2147483647,
1192
- path: '/',
1193
- domain: domain,
1194
- secure: true
1195
- });
1196
-
1197
- case 15:
1198
- redirectUri = localStorage.getItem("redirectUri");
1199
- localStorage.clear();
1200
-
1201
- if (redirectUri != null) {
1202
- window.location.href = redirectUri;
1203
- } else {
1204
- window.location.href = "/";
1205
- }
1206
-
1207
- case 18:
1208
- case "end":
1209
- return _context.stop();
1210
- }
1211
- }
1212
- }, _callee);
1213
- }));
1214
-
1215
- return function signInValidator(_x) {
1216
- return _ref.apply(this, arguments);
1217
- };
1218
- }();
1219
-
1220
- exports.signInValidator = signInValidator;
1221
- "use strict";
1222
-
1223
- Object.defineProperty(exports, "__esModule", {
1224
- value: true
1225
- });
1226
- exports.Slug = void 0;
1227
-
1228
- var Slug = function Slug(slug) {
1229
- var index = slug.lastIndexOf("-") + 1;
1230
-
1231
- if (slug.length > index) {
1232
- slug = slug.substr(index);
1233
- return slug;
1234
- }
1235
-
1236
- return null;
1237
- };
1238
-
1239
- exports.Slug = Slug;
1240
- "use strict";
1241
-
1242
- Object.defineProperty(exports, "__esModule", {
1243
- value: true
1244
- });
1245
- exports.storeWithExpiry = void 0;
1246
-
1247
- var storeWithExpiry = function storeWithExpiry() {
1248
- return {
1249
- set: function set(key, value, ttl) {
1250
- var now = new Date();
1251
- var item = {
1252
- value: value,
1253
- expiry: now.getTime() + ttl
1254
- };
1255
- localStorage.setItem(key, JSON.stringify(item));
1256
- },
1257
- get: function get(key) {
1258
- var itemStr = localStorage.getItem(key);
1259
-
1260
- if (!itemStr) {
1261
- return null;
1262
- }
1263
-
1264
- var item = JSON.parse(itemStr);
1265
- var now = new Date();
1266
-
1267
- if (now.getTime() > item.expiry) {
1268
- localStorage.removeItem(key);
1269
- return null;
1270
- }
1271
-
1272
- return item.value;
1273
- }
1274
- };
1275
- };
1276
-
1277
- exports.storeWithExpiry = storeWithExpiry;
1
+ "use strict";
2
+
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.Datatable = void 0;
9
+
10
+ var _react = _interopRequireWildcard(require("react"));
11
+
12
+ var _reactDataTableComponent = _interopRequireWildcard(require("react-data-table-component"));
13
+
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
+
16
+ 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; }
17
+
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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
19
+
20
+ 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); } }
21
+
22
+ 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); }); }; }
23
+
24
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
25
+
26
+ 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, descriptor.key, descriptor); } }
27
+
28
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
29
+
30
+ 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); }
31
+
32
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
33
+
34
+ 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); }; }
35
+
36
+ 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); }
37
+
38
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
39
+
40
+ 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; } }
41
+
42
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
43
+
44
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
45
+
46
+ var Datatable = /*#__PURE__*/function (_Component) {
47
+ _inherits(Datatable, _Component);
48
+
49
+ var _super = _createSuper(Datatable);
50
+
51
+ function Datatable(props) {
52
+ var _this;
53
+
54
+ _classCallCheck(this, Datatable);
55
+
56
+ _this = _super.call(this, props);
57
+
58
+ _defineProperty(_assertThisInitialized(_this), "componentDidMount", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
59
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
60
+ while (1) {
61
+ switch (_context.prev = _context.next) {
62
+ case 0:
63
+ _context.next = 2;
64
+ return _this.GetDataFromUrl(_this.state.pageNumber, _this.state.pageLength, _this.props.params);
65
+
66
+ case 2:
67
+ (0, _reactDataTableComponent.createTheme)('dataTable', {
68
+ text: {}
69
+ });
70
+
71
+ case 3:
72
+ case "end":
73
+ return _context.stop();
74
+ }
75
+ }
76
+ }, _callee);
77
+ })));
78
+
79
+ _defineProperty(_assertThisInitialized(_this), "reload", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
80
+ var reset,
81
+ _args3 = arguments;
82
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
83
+ while (1) {
84
+ switch (_context3.prev = _context3.next) {
85
+ case 0:
86
+ reset = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : false;
87
+
88
+ if (!(reset === true)) {
89
+ _context3.next = 5;
90
+ break;
91
+ }
92
+
93
+ _this.setState({
94
+ pageNumber: 1
95
+ }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
96
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
97
+ while (1) {
98
+ switch (_context2.prev = _context2.next) {
99
+ case 0:
100
+ _context2.next = 2;
101
+ return _this.GetDataFromUrl(_this.state.pageNumber, _this.state.pageLength, _this.props.params);
102
+
103
+ case 2:
104
+ case "end":
105
+ return _context2.stop();
106
+ }
107
+ }
108
+ }, _callee2);
109
+ })));
110
+
111
+ _context3.next = 7;
112
+ break;
113
+
114
+ case 5:
115
+ _context3.next = 7;
116
+ return _this.GetDataFromUrl(_this.state.pageNumber, _this.state.pageLength, _this.props.params);
117
+
118
+ case 7:
119
+ case "end":
120
+ return _context3.stop();
121
+ }
122
+ }
123
+ }, _callee3);
124
+ })));
125
+
126
+ _defineProperty(_assertThisInitialized(_this), "GetDataFromUrl", function (page, length) {
127
+ var postData = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
128
+
129
+ _this.setState({
130
+ loading: true
131
+ }, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
132
+ var data, response;
133
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
134
+ while (1) {
135
+ switch (_context4.prev = _context4.next) {
136
+ case 0:
137
+ data = postData;
138
+ data.offset = page;
139
+ data.length = length;
140
+ response = null;
141
+
142
+ if (!(this.props.methodType == "get")) {
143
+ _context4.next = 10;
144
+ break;
145
+ }
146
+
147
+ _context4.next = 7;
148
+ return apiService().get(this.props.url);
149
+
150
+ case 7:
151
+ response = _context4.sent;
152
+ _context4.next = 13;
153
+ break;
154
+
155
+ case 10:
156
+ _context4.next = 12;
157
+ return apiService().post(this.props.url, postData);
158
+
159
+ case 12:
160
+ response = _context4.sent;
161
+
162
+ case 13:
163
+ if (response != null && response.status === 200) {
164
+ if (this.props.returnResult != null) {
165
+ this.props.returnResult(response.data.data);
166
+ }
167
+
168
+ this.setState({
169
+ totalRows: response.data.recordsTotal,
170
+ data: response.data.data,
171
+ loading: false
172
+ });
173
+ } else {//console.error(response.status + " - " + response.data);
174
+ }
175
+
176
+ case 14:
177
+ case "end":
178
+ return _context4.stop();
179
+ }
180
+ }
181
+ }, _callee4, this);
182
+ })));
183
+ });
184
+
185
+ _defineProperty(_assertThisInitialized(_this), "handlePageChange", /*#__PURE__*/function () {
186
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(page) {
187
+ var pageLength;
188
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
189
+ while (1) {
190
+ switch (_context5.prev = _context5.next) {
191
+ case 0:
192
+ pageLength = _this.state.pageLength;
193
+
194
+ _this.setState({
195
+ pageNumber: page
196
+ });
197
+
198
+ _context5.next = 4;
199
+ return _this.GetDataFromUrl(page, pageLength, _this.props.params);
200
+
201
+ case 4:
202
+ case "end":
203
+ return _context5.stop();
204
+ }
205
+ }
206
+ }, _callee5);
207
+ }));
208
+
209
+ return function (_x) {
210
+ return _ref5.apply(this, arguments);
211
+ };
212
+ }());
213
+
214
+ _this.state = {
215
+ pageNumber: 1,
216
+ pageLength: props.pageLength ? props.pageLength : 10,
217
+ data: [],
218
+ loading: false,
219
+ totalRows: 0
220
+ };
221
+ return _this;
222
+ }
223
+
224
+ _createClass(Datatable, [{
225
+ key: "render",
226
+ value: function render() {
227
+ return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_reactDataTableComponent["default"], {
228
+ title: this.props.title,
229
+ columns: this.props.columns,
230
+ data: this.state.data,
231
+ paginationRowsPerPageOptions: this.props.pageLength ? [this.props.pageLength] : [10],
232
+ progressPending: this.state.loading,
233
+ customStyles: this.props.customStyles,
234
+ paginationPerPage: this.props.pageLength ? this.props.pageLength : 10,
235
+ paginationServer: true,
236
+ pagination: true,
237
+ paginationTotalRows: this.state.totalRows // onChangeRowsPerPage={this.handlePerRowsChange}
238
+ ,
239
+ onChangePage: this.handlePageChange,
240
+ noDataComponent: this.props.noDataComponent
241
+ }));
242
+ }
243
+ }]);
244
+
245
+ return Datatable;
246
+ }(_react.Component);
247
+
248
+ exports.Datatable = Datatable;
249
+
250
+ _defineProperty(Datatable, "defaultProps", {
251
+ options: {}
252
+ });
253
+ "use strict";
254
+
255
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
256
+
257
+ Object.defineProperty(exports, "__esModule", {
258
+ value: true
259
+ });
260
+ exports["default"] = void 0;
261
+
262
+ var _react = _interopRequireWildcard(require("react"));
263
+
264
+ 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); }
265
+
266
+ 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; }
267
+
268
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
269
+
270
+ 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, descriptor.key, descriptor); } }
271
+
272
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
273
+
274
+ 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); }
275
+
276
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
277
+
278
+ 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); }; }
279
+
280
+ 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); }
281
+
282
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
283
+
284
+ 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; } }
285
+
286
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
287
+
288
+ var DummyComponent = /*#__PURE__*/function (_Component) {
289
+ _inherits(DummyComponent, _Component);
290
+
291
+ var _super = _createSuper(DummyComponent);
292
+
293
+ function DummyComponent() {
294
+ _classCallCheck(this, DummyComponent);
295
+
296
+ return _super.apply(this, arguments);
297
+ }
298
+
299
+ _createClass(DummyComponent, [{
300
+ key: "render",
301
+ value: function render() {
302
+ return /*#__PURE__*/_react["default"].createElement("div", null, "I am a dummy react npm module");
303
+ }
304
+ }]);
305
+
306
+ return DummyComponent;
307
+ }(_react.Component);
308
+
309
+ exports["default"] = DummyComponent;
310
+ "use strict";
311
+
312
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
313
+
314
+ Object.defineProperty(exports, "__esModule", {
315
+ value: true
316
+ });
317
+ exports.apiService = void 0;
318
+
319
+ var _axios = _interopRequireDefault(require("axios"));
320
+
321
+ var _queryString = _interopRequireDefault(require("query-string"));
322
+
323
+ var _jsFileDownload = _interopRequireDefault(require("js-file-download"));
324
+
325
+ var _nookies = require("nookies");
326
+
327
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
328
+
329
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
330
+
331
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
332
+
333
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
334
+
335
+ 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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
336
+
337
+ 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); } }
338
+
339
+ 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); }); }; }
340
+
341
+ var setupDefaultOptions = /*#__PURE__*/function () {
342
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
343
+ var ctx,
344
+ defaultOptions,
345
+ accessToken,
346
+ _args = arguments;
347
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
348
+ while (1) {
349
+ switch (_context.prev = _context.next) {
350
+ case 0:
351
+ ctx = _args.length > 0 && _args[0] !== undefined ? _args[0] : null;
352
+ defaultOptions = {};
353
+
354
+ if (ctx == null) {
355
+ accessToken = (0, _nookies.parseCookies)().access_token || '';
356
+
357
+ if (accessToken !== null && accessToken !== undefined && accessToken != "") {
358
+ defaultOptions = {
359
+ headers: {
360
+ Authorization: "Bearer " + accessToken
361
+ }
362
+ };
363
+ } else {
364
+ defaultOptions = {
365
+ headers: {}
366
+ };
367
+ }
368
+ } else {
369
+ defaultOptions = {
370
+ headers: {}
371
+ };
372
+ }
373
+
374
+ return _context.abrupt("return", defaultOptions);
375
+
376
+ case 4:
377
+ case "end":
378
+ return _context.stop();
379
+ }
380
+ }
381
+ }, _callee);
382
+ }));
383
+
384
+ return function setupDefaultOptions() {
385
+ return _ref.apply(this, arguments);
386
+ };
387
+ }();
388
+
389
+ var RefreshToken = /*#__PURE__*/function () {
390
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(originalRequest, instance) {
391
+ var accessToken, refreshToken, response;
392
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
393
+ while (1) {
394
+ switch (_context2.prev = _context2.next) {
395
+ case 0:
396
+ accessToken = (0, _nookies.parseCookies)().access_token || '';
397
+ refreshToken = (0, _nookies.parseCookies)().refresh_token || '';
398
+ _context2.next = 4;
399
+ return instance.post(process.env.AUTHORITYURI + "/connect/token", _queryString["default"].stringify({
400
+ grant_type: 'refresh_token',
401
+ client_id: process.env.client_id,
402
+ client_secret: process.env.client_secret,
403
+ refresh_token: refreshToken
404
+ }), {
405
+ headers: {
406
+ "Content-Type": "application/x-www-form-urlencoded",
407
+ "Authorization": "Bearer " + accessToken
408
+ }
409
+ });
410
+
411
+ case 4:
412
+ response = _context2.sent;
413
+
414
+ if (!(response != null && response.status == 200)) {
415
+ _context2.next = 13;
416
+ break;
417
+ }
418
+
419
+ originalRequest.headers['Authorization'] = 'Bearer ' + response.data.access_token;
420
+ _context2.next = 9;
421
+ return (0, _nookies.setCookie)(null, "access_token", response.data.access_token, {
422
+ maxAge: 2147483647,
423
+ path: '/',
424
+ domain: process.env.cookieDomain,
425
+ secure: true
426
+ });
427
+
428
+ case 9:
429
+ _context2.next = 11;
430
+ return (0, _nookies.setCookie)(null, "expires_in", response.data.expires_in, {
431
+ maxAge: 2147483647,
432
+ path: '/',
433
+ domain: process.env.cookieDomain,
434
+ secure: true
435
+ });
436
+
437
+ case 11:
438
+ _context2.next = 13;
439
+ return (0, _nookies.setCookie)(null, "refresh_token", response.data.refresh_token, {
440
+ maxAge: 2147483647,
441
+ path: '/',
442
+ domain: process.env.cookieDomain,
443
+ secure: true
444
+ });
445
+
446
+ case 13:
447
+ case "end":
448
+ return _context2.stop();
449
+ }
450
+ }
451
+ }, _callee2);
452
+ }));
453
+
454
+ return function RefreshToken(_x, _x2) {
455
+ return _ref2.apply(this, arguments);
456
+ };
457
+ }();
458
+
459
+ var apiService = function apiService() {
460
+ var ctx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
461
+ var env = process.env.STAGE;
462
+
463
+ if (env == "development") {
464
+ process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
465
+ }
466
+
467
+ var baseUri = process.env.APIURI + "/api";
468
+
469
+ var instance = _axios["default"].create({
470
+ baseURL: baseUri,
471
+ //timeout: 10000,
472
+ params: {} // do not remove this, its added to add params later in the config
473
+
474
+ });
475
+
476
+ instance.interceptors.response.use(function (response) {
477
+ return response;
478
+ }, /*#__PURE__*/function () {
479
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(error) {
480
+ var originalConfig;
481
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
482
+ while (1) {
483
+ switch (_context3.prev = _context3.next) {
484
+ case 0:
485
+ originalConfig = error.config;
486
+
487
+ if (!error.response) {
488
+ _context3.next = 10;
489
+ break;
490
+ }
491
+
492
+ if (!(error.response.status === 401 && !originalConfig._retry)) {
493
+ _context3.next = 7;
494
+ break;
495
+ }
496
+
497
+ originalConfig._retry = true; // Do something, call refreshToken() request for example;
498
+
499
+ _context3.next = 6;
500
+ return RefreshToken(originalConfig, instance);
501
+
502
+ case 6:
503
+ return _context3.abrupt("return", instance.request(originalConfig));
504
+
505
+ case 7:
506
+ if (!(error.response.status === 400)) {
507
+ _context3.next = 10;
508
+ break;
509
+ }
510
+
511
+ // Do something
512
+ if (error.response.config.url.includes("/connect/token")) // remove the access and refresh if invalid
513
+ {
514
+ (0, _nookies.destroyCookie)(null, "access_token", {
515
+ maxAge: 2147483647,
516
+ path: '/',
517
+ domain: process.env.cookieDomain
518
+ });
519
+ (0, _nookies.destroyCookie)(null, "refresh_token", {
520
+ maxAge: 2147483647,
521
+ path: '/',
522
+ domain: process.env.cookieDomain
523
+ });
524
+ (0, _nookies.destroyCookie)(null, "expires_in", {
525
+ maxAge: 2147483647,
526
+ path: '/',
527
+ domain: process.env.cookieDomain
528
+ });
529
+ }
530
+
531
+ return _context3.abrupt("return", Promise.reject(error));
532
+
533
+ case 10:
534
+ return _context3.abrupt("return", Promise.reject(error));
535
+
536
+ case 11:
537
+ case "end":
538
+ return _context3.stop();
539
+ }
540
+ }
541
+ }, _callee3);
542
+ }));
543
+
544
+ return function (_x3) {
545
+ return _ref3.apply(this, arguments);
546
+ };
547
+ }());
548
+ return {
549
+ get: function () {
550
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(url) {
551
+ var options,
552
+ defaultOptions,
553
+ _args4 = arguments;
554
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
555
+ while (1) {
556
+ switch (_context4.prev = _context4.next) {
557
+ case 0:
558
+ options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
559
+ _context4.prev = 1;
560
+ _context4.next = 4;
561
+ return setupDefaultOptions(ctx);
562
+
563
+ case 4:
564
+ defaultOptions = _context4.sent;
565
+ _context4.next = 7;
566
+ return instance.get(url, _objectSpread(_objectSpread({}, defaultOptions), options));
567
+
568
+ case 7:
569
+ return _context4.abrupt("return", _context4.sent);
570
+
571
+ case 10:
572
+ _context4.prev = 10;
573
+ _context4.t0 = _context4["catch"](1);
574
+ return _context4.abrupt("return", _context4.t0.response);
575
+
576
+ case 13:
577
+ case "end":
578
+ return _context4.stop();
579
+ }
580
+ }
581
+ }, _callee4, null, [[1, 10]]);
582
+ }));
583
+
584
+ function get(_x4) {
585
+ return _get.apply(this, arguments);
586
+ }
587
+
588
+ return get;
589
+ }(),
590
+ post: function () {
591
+ var _post = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(url, data) {
592
+ var options,
593
+ defaultOptions,
594
+ _args5 = arguments;
595
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
596
+ while (1) {
597
+ switch (_context5.prev = _context5.next) {
598
+ case 0:
599
+ options = _args5.length > 2 && _args5[2] !== undefined ? _args5[2] : {};
600
+ _context5.prev = 1;
601
+ _context5.next = 4;
602
+ return setupDefaultOptions(ctx);
603
+
604
+ case 4:
605
+ defaultOptions = _context5.sent;
606
+ _context5.next = 7;
607
+ return instance.post(url, data, _objectSpread(_objectSpread({}, defaultOptions), options));
608
+
609
+ case 7:
610
+ return _context5.abrupt("return", _context5.sent);
611
+
612
+ case 10:
613
+ _context5.prev = 10;
614
+ _context5.t0 = _context5["catch"](1);
615
+ return _context5.abrupt("return", _context5.t0.response);
616
+
617
+ case 13:
618
+ case "end":
619
+ return _context5.stop();
620
+ }
621
+ }
622
+ }, _callee5, null, [[1, 10]]);
623
+ }));
624
+
625
+ function post(_x5, _x6) {
626
+ return _post.apply(this, arguments);
627
+ }
628
+
629
+ return post;
630
+ }(),
631
+ put: function () {
632
+ var _put = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(url, data) {
633
+ var options,
634
+ defaultOptions,
635
+ _args6 = arguments;
636
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
637
+ while (1) {
638
+ switch (_context6.prev = _context6.next) {
639
+ case 0:
640
+ options = _args6.length > 2 && _args6[2] !== undefined ? _args6[2] : {};
641
+ _context6.prev = 1;
642
+ _context6.next = 4;
643
+ return setupDefaultOptions(ctx);
644
+
645
+ case 4:
646
+ defaultOptions = _context6.sent;
647
+ _context6.next = 7;
648
+ return instance.put(url, data, _objectSpread(_objectSpread({}, defaultOptions), options));
649
+
650
+ case 7:
651
+ return _context6.abrupt("return", _context6.sent);
652
+
653
+ case 10:
654
+ _context6.prev = 10;
655
+ _context6.t0 = _context6["catch"](1);
656
+ return _context6.abrupt("return", _context6.t0.response);
657
+
658
+ case 13:
659
+ case "end":
660
+ return _context6.stop();
661
+ }
662
+ }
663
+ }, _callee6, null, [[1, 10]]);
664
+ }));
665
+
666
+ function put(_x7, _x8) {
667
+ return _put.apply(this, arguments);
668
+ }
669
+
670
+ return put;
671
+ }(),
672
+ "delete": function () {
673
+ var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(url) {
674
+ var options,
675
+ defaultOptions,
676
+ _args7 = arguments;
677
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
678
+ while (1) {
679
+ switch (_context7.prev = _context7.next) {
680
+ case 0:
681
+ options = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : {};
682
+ _context7.prev = 1;
683
+ _context7.next = 4;
684
+ return setupDefaultOptions(ctx);
685
+
686
+ case 4:
687
+ defaultOptions = _context7.sent;
688
+ _context7.next = 7;
689
+ return instance["delete"](url, _objectSpread(_objectSpread({}, defaultOptions), options));
690
+
691
+ case 7:
692
+ return _context7.abrupt("return", _context7.sent);
693
+
694
+ case 10:
695
+ _context7.prev = 10;
696
+ _context7.t0 = _context7["catch"](1);
697
+ return _context7.abrupt("return", _context7.t0.response);
698
+
699
+ case 13:
700
+ case "end":
701
+ return _context7.stop();
702
+ }
703
+ }
704
+ }, _callee7, null, [[1, 10]]);
705
+ }));
706
+
707
+ function _delete(_x9) {
708
+ return _delete2.apply(this, arguments);
709
+ }
710
+
711
+ return _delete;
712
+ }(),
713
+ GetCurrentUser: function () {
714
+ var _GetCurrentUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
715
+ var accessToken, defaultOptions, response;
716
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
717
+ while (1) {
718
+ switch (_context8.prev = _context8.next) {
719
+ case 0:
720
+ _context8.prev = 0;
721
+ accessToken = (0, _nookies.parseCookies)().access_token || null;
722
+
723
+ if (!accessToken) {
724
+ _context8.next = 11;
725
+ break;
726
+ }
727
+
728
+ _context8.next = 5;
729
+ return setupDefaultOptions(null);
730
+
731
+ case 5:
732
+ defaultOptions = _context8.sent;
733
+ _context8.next = 8;
734
+ return instance.get('/UserManagement/get', defaultOptions);
735
+
736
+ case 8:
737
+ response = _context8.sent;
738
+
739
+ if (!(response != null && response.status == 200)) {
740
+ _context8.next = 11;
741
+ break;
742
+ }
743
+
744
+ return _context8.abrupt("return", response.data);
745
+
746
+ case 11:
747
+ _context8.next = 16;
748
+ break;
749
+
750
+ case 13:
751
+ _context8.prev = 13;
752
+ _context8.t0 = _context8["catch"](0);
753
+ //return -1;
754
+ console.log(_context8.t0.message);
755
+
756
+ case 16:
757
+ return _context8.abrupt("return", null);
758
+
759
+ case 17:
760
+ case "end":
761
+ return _context8.stop();
762
+ }
763
+ }
764
+ }, _callee8, null, [[0, 13]]);
765
+ }));
766
+
767
+ function GetCurrentUser() {
768
+ return _GetCurrentUser.apply(this, arguments);
769
+ }
770
+
771
+ return GetCurrentUser;
772
+ }(),
773
+ DownloadFile: function () {
774
+ var _DownloadFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(url, fileName, completed) {
775
+ var defaultOptions, options, response;
776
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
777
+ while (1) {
778
+ switch (_context9.prev = _context9.next) {
779
+ case 0:
780
+ _context9.prev = 0;
781
+ //let defaultOptions = await setupDefaultOptions();
782
+ defaultOptions = {};
783
+ options = {
784
+ responseType: "blob"
785
+ };
786
+ _context9.next = 5;
787
+ return instance.get(url, _objectSpread(_objectSpread({}, defaultOptions), options));
788
+
789
+ case 5:
790
+ response = _context9.sent;
791
+
792
+ if (response.status === 200) {
793
+ (0, _jsFileDownload["default"])(response.data, fileName);
794
+
795
+ if (completed !== undefined) {
796
+ completed();
797
+ }
798
+ }
799
+
800
+ _context9.next = 13;
801
+ break;
802
+
803
+ case 9:
804
+ _context9.prev = 9;
805
+ _context9.t0 = _context9["catch"](0);
806
+ console.error(_context9.t0);
807
+
808
+ if (completed !== undefined) {
809
+ completed();
810
+ }
811
+
812
+ case 13:
813
+ case "end":
814
+ return _context9.stop();
815
+ }
816
+ }
817
+ }, _callee9, null, [[0, 9]]);
818
+ }));
819
+
820
+ function DownloadFile(_x10, _x11, _x12) {
821
+ return _DownloadFile.apply(this, arguments);
822
+ }
823
+
824
+ return DownloadFile;
825
+ }()
826
+ };
827
+ };
828
+
829
+ exports.apiService = apiService;
830
+ "use strict";
831
+
832
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
833
+
834
+ Object.defineProperty(exports, "__esModule", {
835
+ value: true
836
+ });
837
+ exports.AuthorizationComponent = AuthorizationComponent;
838
+
839
+ var _react = _interopRequireWildcard(require("react"));
840
+
841
+ 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); }
842
+
843
+ 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; }
844
+
845
+ 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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
846
+
847
+ 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); } }
848
+
849
+ 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); }); }; }
850
+
851
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
852
+
853
+ 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."); }
854
+
855
+ 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); }
856
+
857
+ 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; }
858
+
859
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
860
+
861
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
862
+
863
+ //import apiService from './apiService';
864
+ function AuthorizationComponent(_ref) {
865
+ var children = _ref.children,
866
+ setCurrentUser = _ref.setCurrentUser,
867
+ userLoaded = _ref.userLoaded,
868
+ isLoading = _ref.isLoading;
869
+
870
+ var _useState = (0, _react.useState)(false),
871
+ _useState2 = _slicedToArray(_useState, 2),
872
+ loaded = _useState2[0],
873
+ setLoaded = _useState2[1];
874
+
875
+ var validateUserSignedIn = /*#__PURE__*/function () {
876
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
877
+ var usr;
878
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
879
+ while (1) {
880
+ switch (_context.prev = _context.next) {
881
+ case 0:
882
+ setLoaded(true);
883
+ _context.next = 3;
884
+ return apiService().GetCurrentUser();
885
+
886
+ case 3:
887
+ usr = _context.sent;
888
+
889
+ if (usr != null) {
890
+ setCurrentUser(usr);
891
+ } else {
892
+ setCurrentUser(null);
893
+ }
894
+
895
+ userLoaded();
896
+
897
+ case 6:
898
+ case "end":
899
+ return _context.stop();
900
+ }
901
+ }
902
+ }, _callee);
903
+ }));
904
+
905
+ return function validateUserSignedIn() {
906
+ return _ref2.apply(this, arguments);
907
+ };
908
+ }();
909
+
910
+ (0, _react.useEffect)(function () {
911
+ if (!loaded) {
912
+ validateUserSignedIn();
913
+ }
914
+ }, [loaded]);
915
+ return children;
916
+ }
917
+ "use strict";
918
+
919
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
920
+
921
+ Object.defineProperty(exports, "__esModule", {
922
+ value: true
923
+ });
924
+ exports.authService = void 0;
925
+
926
+ var _react = _interopRequireDefault(require("react"));
927
+
928
+ var _nookies = require("nookies");
929
+
930
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
931
+
932
+ 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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
933
+
934
+ 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); } }
935
+
936
+ 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); }); }; }
937
+
938
+ var authService = function authService() {
939
+ return {
940
+ dec2hex: function dec2hex(dec) {
941
+ return ('0' + dec.toString(16)).substr(-2);
942
+ },
943
+ generateRandomString: function generateRandomString() {
944
+ var array = new Uint32Array(56 / 2);
945
+ window.crypto.getRandomValues(array);
946
+ return Array.from(array, authService().dec2hex).join('');
947
+ },
948
+ sha256: function sha256(plain) {
949
+ var encoder = new TextEncoder();
950
+ var data = encoder.encode(plain);
951
+ return window.crypto.subtle.digest('SHA-256', data);
952
+ },
953
+ base64urlencode: function base64urlencode(a) {
954
+ var str = "";
955
+ var bytes = new Uint8Array(a);
956
+ var len = bytes.byteLength;
957
+
958
+ for (var i = 0; i < len; i++) {
959
+ str += String.fromCharCode(bytes[i]);
960
+ }
961
+
962
+ return btoa(str).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
963
+ },
964
+ challenge_from_verifier: function () {
965
+ var _challenge_from_verifier = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(v) {
966
+ var hashed, base64encoded;
967
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
968
+ while (1) {
969
+ switch (_context.prev = _context.next) {
970
+ case 0:
971
+ _context.next = 2;
972
+ return authService().sha256(v);
973
+
974
+ case 2:
975
+ hashed = _context.sent;
976
+ base64encoded = authService().base64urlencode(hashed);
977
+ return _context.abrupt("return", base64encoded);
978
+
979
+ case 5:
980
+ case "end":
981
+ return _context.stop();
982
+ }
983
+ }
984
+ }, _callee);
985
+ }));
986
+
987
+ function challenge_from_verifier(_x) {
988
+ return _challenge_from_verifier.apply(this, arguments);
989
+ }
990
+
991
+ return challenge_from_verifier;
992
+ }(),
993
+ login: function () {
994
+ var _login = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
995
+ var redirectUserUri,
996
+ dnsRecord,
997
+ deviceId,
998
+ state,
999
+ verifier,
1000
+ challenge,
1001
+ redirectUri,
1002
+ loginUri,
1003
+ _args2 = arguments;
1004
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1005
+ while (1) {
1006
+ switch (_context2.prev = _context2.next) {
1007
+ case 0:
1008
+ redirectUserUri = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : null;
1009
+ dnsRecord = _args2.length > 1 && _args2[1] !== undefined ? _args2[1] : null;
1010
+ deviceId = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : null;
1011
+ state = "1234";
1012
+
1013
+ if (redirectUserUri != null) {
1014
+ localStorage.setItem("redirectUri", redirectUserUri);
1015
+ }
1016
+
1017
+ verifier = authService().generateRandomString();
1018
+ _context2.next = 8;
1019
+ return authService().challenge_from_verifier(verifier);
1020
+
1021
+ case 8:
1022
+ challenge = _context2.sent;
1023
+ window.localStorage.setItem("verifier", verifier);
1024
+ redirectUri = window.location.origin + "/signin-oidc";
1025
+ loginUri = process.env.AUTHORITYURI + "/connect/authorize?response_type=code&state=" + state + "&client_id=" + process.env.client_id + "&scope=email%20openid%20offline_access%20profile%20api1&redirect_uri=" + redirectUri + "&code_challenge=" + challenge + "&code_challenge_method=S256";
1026
+
1027
+ if (deviceId) {
1028
+ loginUri += "&deviceId=" + deviceId; // will be for chrome extention and mobile apps later
1029
+ }
1030
+
1031
+ window.location.href = loginUri;
1032
+
1033
+ case 14:
1034
+ case "end":
1035
+ return _context2.stop();
1036
+ }
1037
+ }
1038
+ }, _callee2);
1039
+ }));
1040
+
1041
+ function login() {
1042
+ return _login.apply(this, arguments);
1043
+ }
1044
+
1045
+ return login;
1046
+ }(),
1047
+ signUp: function signUp() {
1048
+ var redirectUrl = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
1049
+ var AuthUri = process.env.AUTHORITYURI;
1050
+ var url = "";
1051
+
1052
+ if (redirectUrl == null) {
1053
+ url = AuthUri + "/Account/Register?returnUrl=" + window.location.href;
1054
+ localStorage.setItem("redirectUri", window.location.href);
1055
+ } else {
1056
+ url = AuthUri + "/Account/Register?returnUrl=" + redirectUrl;
1057
+ localStorage.setItem("redirectUri", redirectUrl);
1058
+ }
1059
+
1060
+ window.location.href = url;
1061
+ },
1062
+ logout: function () {
1063
+ var _logout = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
1064
+ var AuthUri, cookieDomain;
1065
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1066
+ while (1) {
1067
+ switch (_context3.prev = _context3.next) {
1068
+ case 0:
1069
+ AuthUri = process.env.AUTHORITYURI;
1070
+ cookieDomain = process.env.cookieDomain;
1071
+ (0, _nookies.destroyCookie)({}, "access_token", {
1072
+ maxAge: 2147483647,
1073
+ path: '/',
1074
+ domain: cookieDomain
1075
+ });
1076
+ (0, _nookies.destroyCookie)({}, "refresh_token", {
1077
+ maxAge: 2147483647,
1078
+ path: '/',
1079
+ domain: cookieDomain
1080
+ });
1081
+ (0, _nookies.destroyCookie)({}, "expires_in", {
1082
+ maxAge: 2147483647,
1083
+ path: '/',
1084
+ domain: cookieDomain
1085
+ });
1086
+ setTimeout(function () {
1087
+ window.location.href = AuthUri + "/connect/logout?redirect=" + window.location.href;
1088
+ }, 500);
1089
+
1090
+ case 6:
1091
+ case "end":
1092
+ return _context3.stop();
1093
+ }
1094
+ }
1095
+ }, _callee3);
1096
+ }));
1097
+
1098
+ function logout() {
1099
+ return _logout.apply(this, arguments);
1100
+ }
1101
+
1102
+ return logout;
1103
+ }()
1104
+ };
1105
+ };
1106
+
1107
+ exports.authService = authService;
1108
+ "use strict";
1109
+
1110
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
1111
+
1112
+ Object.defineProperty(exports, "__esModule", {
1113
+ value: true
1114
+ });
1115
+ exports.signInValidator = void 0;
1116
+
1117
+ var _react = _interopRequireWildcard(require("react"));
1118
+
1119
+ var _axios = _interopRequireDefault(require("axios"));
1120
+
1121
+ var _queryString = _interopRequireDefault(require("query-string"));
1122
+
1123
+ var _nookies = require("nookies");
1124
+
1125
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
1126
+
1127
+ 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); }
1128
+
1129
+ 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; }
1130
+
1131
+ 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 exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
1132
+
1133
+ 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); } }
1134
+
1135
+ 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); }); }; }
1136
+
1137
+ var signInValidator = /*#__PURE__*/function () {
1138
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(queryCode) {
1139
+ var codeVerifier, headers, queryString, response, domain, redirectUri;
1140
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1141
+ while (1) {
1142
+ switch (_context.prev = _context.next) {
1143
+ case 0:
1144
+ codeVerifier = window.localStorage.getItem("verifier");
1145
+
1146
+ if (!(queryCode != null && codeVerifier != null)) {
1147
+ _context.next = 18;
1148
+ break;
1149
+ }
1150
+
1151
+ headers = {
1152
+ 'Content-Type': 'application/x-www-form-urlencoded'
1153
+ };
1154
+ queryString = _queryString["default"].stringify({
1155
+ code: queryCode,
1156
+ grant_type: "authorization_code",
1157
+ redirect_uri: window.location.origin + "/signin-oidc",
1158
+ client_id: process.env.client_id,
1159
+ client_secret: process.env.client_secret,
1160
+ code_verifier: codeVerifier
1161
+ });
1162
+ _context.next = 6;
1163
+ return _axios["default"].post(process.env.AUTHORITYURI + '/connect/token', queryString, {
1164
+ headers: headers
1165
+ });
1166
+
1167
+ case 6:
1168
+ response = _context.sent;
1169
+ window.localStorage.removeItem("verifier");
1170
+ domain = process.env.cookieDomain;
1171
+ _context.next = 11;
1172
+ return (0, _nookies.setCookie)(null, "access_token", response.data.access_token, {
1173
+ maxAge: 2147483647,
1174
+ path: '/',
1175
+ domain: domain,
1176
+ secure: true
1177
+ });
1178
+
1179
+ case 11:
1180
+ _context.next = 13;
1181
+ return (0, _nookies.setCookie)(null, "expires_in", response.data.expires_in, {
1182
+ maxAge: 2147483647,
1183
+ path: '/',
1184
+ domain: domain,
1185
+ secure: true
1186
+ });
1187
+
1188
+ case 13:
1189
+ _context.next = 15;
1190
+ return (0, _nookies.setCookie)(null, "refresh_token", response.data.refresh_token, {
1191
+ maxAge: 2147483647,
1192
+ path: '/',
1193
+ domain: domain,
1194
+ secure: true
1195
+ });
1196
+
1197
+ case 15:
1198
+ redirectUri = localStorage.getItem("redirectUri");
1199
+ localStorage.clear();
1200
+
1201
+ if (redirectUri != null) {
1202
+ window.location.href = redirectUri;
1203
+ } else {
1204
+ window.location.href = "/";
1205
+ }
1206
+
1207
+ case 18:
1208
+ case "end":
1209
+ return _context.stop();
1210
+ }
1211
+ }
1212
+ }, _callee);
1213
+ }));
1214
+
1215
+ return function signInValidator(_x) {
1216
+ return _ref.apply(this, arguments);
1217
+ };
1218
+ }();
1219
+
1220
+ exports.signInValidator = signInValidator;
1221
+ "use strict";
1222
+
1223
+ Object.defineProperty(exports, "__esModule", {
1224
+ value: true
1225
+ });
1226
+ exports.Slug = void 0;
1227
+
1228
+ var Slug = function Slug(slug) {
1229
+ var index = slug.lastIndexOf("-") + 1;
1230
+
1231
+ if (slug.length > index) {
1232
+ slug = slug.substr(index);
1233
+ return slug;
1234
+ }
1235
+
1236
+ return null;
1237
+ };
1238
+
1239
+ exports.Slug = Slug;
1240
+ "use strict";
1241
+
1242
+ Object.defineProperty(exports, "__esModule", {
1243
+ value: true
1244
+ });
1245
+ exports.storeWithExpiry = void 0;
1246
+
1247
+ var storeWithExpiry = function storeWithExpiry() {
1248
+ return {
1249
+ set: function set(key, value, ttl) {
1250
+ var now = new Date();
1251
+ var item = {
1252
+ value: value,
1253
+ expiry: now.getTime() + ttl
1254
+ };
1255
+ localStorage.setItem(key, JSON.stringify(item));
1256
+ },
1257
+ get: function get(key) {
1258
+ var itemStr = localStorage.getItem(key);
1259
+
1260
+ if (!itemStr) {
1261
+ return null;
1262
+ }
1263
+
1264
+ var item = JSON.parse(itemStr);
1265
+ var now = new Date();
1266
+
1267
+ if (now.getTime() > item.expiry) {
1268
+ localStorage.removeItem(key);
1269
+ return null;
1270
+ }
1271
+
1272
+ return item.value;
1273
+ }
1274
+ };
1275
+ };
1276
+
1277
+ exports.storeWithExpiry = storeWithExpiry;