dauth-context-react 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,349 +1,146 @@
1
1
  import React, { useReducer, useCallback, useEffect, useMemo, createContext, useContext } from 'react';
2
2
 
3
- function _regeneratorRuntime() {
4
- _regeneratorRuntime = function () {
5
- return e;
6
- };
7
- var t,
8
- e = {},
9
- r = Object.prototype,
10
- n = r.hasOwnProperty,
11
- o = Object.defineProperty || function (t, e, r) {
12
- t[e] = r.value;
13
- },
14
- i = "function" == typeof Symbol ? Symbol : {},
15
- a = i.iterator || "@@iterator",
16
- c = i.asyncIterator || "@@asyncIterator",
17
- u = i.toStringTag || "@@toStringTag";
18
- function define(t, e, r) {
19
- return Object.defineProperty(t, e, {
20
- value: r,
21
- enumerable: !0,
22
- configurable: !0,
23
- writable: !0
24
- }), t[e];
25
- }
3
+ function asyncGeneratorStep(n, t, e, r, o, a, c) {
26
4
  try {
27
- define({}, "");
28
- } catch (t) {
29
- define = function (t, e, r) {
30
- return t[e] = r;
31
- };
32
- }
33
- function wrap(t, e, r, n) {
34
- var i = e && e.prototype instanceof Generator ? e : Generator,
35
- a = Object.create(i.prototype),
36
- c = new Context(n || []);
37
- return o(a, "_invoke", {
38
- value: makeInvokeMethod(t, r, c)
39
- }), a;
40
- }
41
- function tryCatch(t, e, r) {
42
- try {
43
- return {
44
- type: "normal",
45
- arg: t.call(e, r)
46
- };
47
- } catch (t) {
48
- return {
49
- type: "throw",
50
- arg: t
51
- };
52
- }
53
- }
54
- e.wrap = wrap;
55
- var h = "suspendedStart",
56
- l = "suspendedYield",
57
- f = "executing",
58
- s = "completed",
59
- y = {};
60
- function Generator() {}
61
- function GeneratorFunction() {}
62
- function GeneratorFunctionPrototype() {}
63
- var p = {};
64
- define(p, a, function () {
65
- return this;
66
- });
67
- var d = Object.getPrototypeOf,
68
- v = d && d(d(values([])));
69
- v && v !== r && n.call(v, a) && (p = v);
70
- var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p);
71
- function defineIteratorMethods(t) {
72
- ["next", "throw", "return"].forEach(function (e) {
73
- define(t, e, function (t) {
74
- return this._invoke(e, t);
75
- });
76
- });
5
+ var i = n[a](c),
6
+ u = i.value;
7
+ } catch (n) {
8
+ return void e(n);
77
9
  }
78
- function AsyncIterator(t, e) {
79
- function invoke(r, o, i, a) {
80
- var c = tryCatch(t[r], t, o);
81
- if ("throw" !== c.type) {
82
- var u = c.arg,
83
- h = u.value;
84
- return h && "object" == typeof h && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) {
85
- invoke("next", t, i, a);
86
- }, function (t) {
87
- invoke("throw", t, i, a);
88
- }) : e.resolve(h).then(function (t) {
89
- u.value = t, i(u);
90
- }, function (t) {
91
- return invoke("throw", t, i, a);
92
- });
10
+ i.done ? t(u) : Promise.resolve(u).then(r, o);
11
+ }
12
+ function _asyncToGenerator(n) {
13
+ return function () {
14
+ var t = this,
15
+ e = arguments;
16
+ return new Promise(function (r, o) {
17
+ var a = n.apply(t, e);
18
+ function _next(n) {
19
+ asyncGeneratorStep(a, r, o, _next, _throw, "next", n);
93
20
  }
94
- a(c.arg);
95
- }
96
- var r;
97
- o(this, "_invoke", {
98
- value: function (t, n) {
99
- function callInvokeWithMethodAndArg() {
100
- return new e(function (e, r) {
101
- invoke(t, n, e, r);
102
- });
103
- }
104
- return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
21
+ function _throw(n) {
22
+ asyncGeneratorStep(a, r, o, _next, _throw, "throw", n);
105
23
  }
24
+ _next(void 0);
106
25
  });
107
- }
108
- function makeInvokeMethod(e, r, n) {
109
- var o = h;
110
- return function (i, a) {
111
- if (o === f) throw new Error("Generator is already running");
112
- if (o === s) {
113
- if ("throw" === i) throw a;
114
- return {
115
- value: t,
116
- done: !0
26
+ };
27
+ }
28
+ function _extends() {
29
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
30
+ for (var e = 1; e < arguments.length; e++) {
31
+ var t = arguments[e];
32
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
33
+ }
34
+ return n;
35
+ }, _extends.apply(null, arguments);
36
+ }
37
+ function _regenerator() {
38
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
39
+ var e,
40
+ t,
41
+ r = "function" == typeof Symbol ? Symbol : {},
42
+ n = r.iterator || "@@iterator",
43
+ o = r.toStringTag || "@@toStringTag";
44
+ function i(r, n, o, i) {
45
+ var c = n && n.prototype instanceof Generator ? n : Generator,
46
+ u = Object.create(c.prototype);
47
+ return _regeneratorDefine(u, "_invoke", function (r, n, o) {
48
+ var i,
49
+ c,
50
+ u,
51
+ f = 0,
52
+ p = o || [],
53
+ y = !1,
54
+ G = {
55
+ p: 0,
56
+ n: 0,
57
+ v: e,
58
+ a: d,
59
+ f: d.bind(e, 4),
60
+ d: function (t, r) {
61
+ return i = t, c = 0, u = e, G.n = r, a;
62
+ }
117
63
  };
64
+ function d(r, n) {
65
+ for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) {
66
+ var o,
67
+ i = p[t],
68
+ d = G.p,
69
+ l = i[2];
70
+ r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0));
71
+ }
72
+ if (o || r > 1) return a;
73
+ throw y = !0, n;
118
74
  }
119
- for (n.method = i, n.arg = a;;) {
120
- var c = n.delegate;
121
- if (c) {
122
- var u = maybeInvokeDelegate(c, n);
123
- if (u) {
124
- if (u === y) continue;
125
- return u;
75
+ return function (o, p, l) {
76
+ if (f > 1) throw TypeError("Generator is already running");
77
+ for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) {
78
+ i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u);
79
+ try {
80
+ if (f = 2, i) {
81
+ if (c || (o = "next"), t = i[o]) {
82
+ if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object");
83
+ if (!t.done) return t;
84
+ u = t.value, c < 2 && (c = 0);
85
+ } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1);
86
+ i = e;
87
+ } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break;
88
+ } catch (t) {
89
+ i = e, c = 1, u = t;
90
+ } finally {
91
+ f = 1;
126
92
  }
127
93
  }
128
- if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) {
129
- if (o === h) throw o = s, n.arg;
130
- n.dispatchException(n.arg);
131
- } else "return" === n.method && n.abrupt("return", n.arg);
132
- o = f;
133
- var p = tryCatch(e, r, n);
134
- if ("normal" === p.type) {
135
- if (o = n.done ? s : l, p.arg === y) continue;
136
- return {
137
- value: p.arg,
138
- done: n.done
139
- };
140
- }
141
- "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg);
142
- }
143
- };
144
- }
145
- function maybeInvokeDelegate(e, r) {
146
- var n = r.method,
147
- o = e.iterator[n];
148
- if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y;
149
- var i = tryCatch(o, e.iterator, r.arg);
150
- if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y;
151
- var a = i.arg;
152
- return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y);
153
- }
154
- function pushTryEntry(t) {
155
- var e = {
156
- tryLoc: t[0]
157
- };
158
- 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e);
159
- }
160
- function resetTryEntry(t) {
161
- var e = t.completion || {};
162
- e.type = "normal", delete e.arg, t.completion = e;
163
- }
164
- function Context(t) {
165
- this.tryEntries = [{
166
- tryLoc: "root"
167
- }], t.forEach(pushTryEntry, this), this.reset(!0);
94
+ return {
95
+ value: t,
96
+ done: y
97
+ };
98
+ };
99
+ }(r, o, i), !0), u;
168
100
  }
169
- function values(e) {
170
- if (e || "" === e) {
171
- var r = e[a];
172
- if (r) return r.call(e);
173
- if ("function" == typeof e.next) return e;
174
- if (!isNaN(e.length)) {
175
- var o = -1,
176
- i = function next() {
177
- for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next;
178
- return next.value = t, next.done = !0, next;
179
- };
180
- return i.next = i;
181
- }
182
- }
183
- throw new TypeError(typeof e + " is not iterable");
101
+ var a = {};
102
+ function Generator() {}
103
+ function GeneratorFunction() {}
104
+ function GeneratorFunctionPrototype() {}
105
+ t = Object.getPrototypeOf;
106
+ var c = [][n] ? t(t([][n]())) : (_regeneratorDefine(t = {}, n, function () {
107
+ return this;
108
+ }), t),
109
+ u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c);
110
+ function f(e) {
111
+ return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e;
184
112
  }
185
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
186
- value: GeneratorFunctionPrototype,
187
- configurable: !0
188
- }), o(GeneratorFunctionPrototype, "constructor", {
189
- value: GeneratorFunction,
190
- configurable: !0
191
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
192
- var e = "function" == typeof t && t.constructor;
193
- return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
194
- }, e.mark = function (t) {
195
- return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t;
196
- }, e.awrap = function (t) {
197
- return {
198
- __await: t
199
- };
200
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () {
201
- return this;
202
- }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) {
203
- void 0 === i && (i = Promise);
204
- var a = new AsyncIterator(wrap(t, r, n, o), i);
205
- return e.isGeneratorFunction(r) ? a : a.next().then(function (t) {
206
- return t.done ? t.value : a.next();
207
- });
208
- }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () {
113
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine(u), _regeneratorDefine(u, o, "Generator"), _regeneratorDefine(u, n, function () {
209
114
  return this;
210
- }), define(g, "toString", function () {
115
+ }), _regeneratorDefine(u, "toString", function () {
211
116
  return "[object Generator]";
212
- }), e.keys = function (t) {
213
- var e = Object(t),
214
- r = [];
215
- for (var n in e) r.push(n);
216
- return r.reverse(), function next() {
217
- for (; r.length;) {
218
- var t = r.pop();
219
- if (t in e) return next.value = t, next.done = !1, next;
220
- }
221
- return next.done = !0, next;
117
+ }), (_regenerator = function () {
118
+ return {
119
+ w: i,
120
+ m: f
222
121
  };
223
- }, e.values = values, Context.prototype = {
224
- constructor: Context,
225
- reset: function (e) {
226
- if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
227
- },
228
- stop: function () {
229
- this.done = !0;
230
- var t = this.tryEntries[0].completion;
231
- if ("throw" === t.type) throw t.arg;
232
- return this.rval;
233
- },
234
- dispatchException: function (e) {
235
- if (this.done) throw e;
236
- var r = this;
237
- function handle(n, o) {
238
- return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o;
239
- }
240
- for (var o = this.tryEntries.length - 1; o >= 0; --o) {
241
- var i = this.tryEntries[o],
242
- a = i.completion;
243
- if ("root" === i.tryLoc) return handle("end");
244
- if (i.tryLoc <= this.prev) {
245
- var c = n.call(i, "catchLoc"),
246
- u = n.call(i, "finallyLoc");
247
- if (c && u) {
248
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
249
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
250
- } else if (c) {
251
- if (this.prev < i.catchLoc) return handle(i.catchLoc, !0);
252
- } else {
253
- if (!u) throw new Error("try statement without catch or finally");
254
- if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
255
- }
256
- }
257
- }
258
- },
259
- abrupt: function (t, e) {
260
- for (var r = this.tryEntries.length - 1; r >= 0; --r) {
261
- var o = this.tryEntries[r];
262
- if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) {
263
- var i = o;
264
- break;
265
- }
266
- }
267
- i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null);
268
- var a = i ? i.completion : {};
269
- return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a);
270
- },
271
- complete: function (t, e) {
272
- if ("throw" === t.type) throw t.arg;
273
- return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y;
274
- },
275
- finish: function (t) {
276
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
277
- var r = this.tryEntries[e];
278
- if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y;
279
- }
280
- },
281
- catch: function (t) {
282
- for (var e = this.tryEntries.length - 1; e >= 0; --e) {
283
- var r = this.tryEntries[e];
284
- if (r.tryLoc === t) {
285
- var n = r.completion;
286
- if ("throw" === n.type) {
287
- var o = n.arg;
288
- resetTryEntry(r);
289
- }
290
- return o;
291
- }
292
- }
293
- throw new Error("illegal catch attempt");
294
- },
295
- delegateYield: function (e, r, n) {
296
- return this.delegate = {
297
- iterator: values(e),
298
- resultName: r,
299
- nextLoc: n
300
- }, "next" === this.method && (this.arg = t), y;
301
- }
302
- }, e;
122
+ })();
303
123
  }
304
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
124
+ function _regeneratorDefine(e, r, n, t) {
125
+ var i = Object.defineProperty;
305
126
  try {
306
- var info = gen[key](arg);
307
- var value = info.value;
308
- } catch (error) {
309
- reject(error);
310
- return;
127
+ i({}, "", {});
128
+ } catch (e) {
129
+ i = 0;
311
130
  }
312
- if (info.done) {
313
- resolve(value);
314
- } else {
315
- Promise.resolve(value).then(_next, _throw);
316
- }
317
- }
318
- function _asyncToGenerator(fn) {
319
- return function () {
320
- var self = this,
321
- args = arguments;
322
- return new Promise(function (resolve, reject) {
323
- var gen = fn.apply(self, args);
324
- function _next(value) {
325
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
326
- }
327
- function _throw(err) {
328
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
329
- }
330
- _next(undefined);
331
- });
332
- };
333
- }
334
- function _extends() {
335
- _extends = Object.assign ? Object.assign.bind() : function (target) {
336
- for (var i = 1; i < arguments.length; i++) {
337
- var source = arguments[i];
338
- for (var key in source) {
339
- if (Object.prototype.hasOwnProperty.call(source, key)) {
340
- target[key] = source[key];
341
- }
342
- }
131
+ _regeneratorDefine = function (e, r, n, t) {
132
+ function o(r, n) {
133
+ _regeneratorDefine(e, r, function (e) {
134
+ return this._invoke(r, n, e);
135
+ });
343
136
  }
344
- return target;
345
- };
346
- return _extends.apply(this, arguments);
137
+ r ? i ? i(e, r, {
138
+ value: n,
139
+ enumerable: !t,
140
+ configurable: !t,
141
+ writable: !t
142
+ }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
143
+ }, _regeneratorDefine(e, r, n, t);
347
144
  }
348
145
 
349
146
  var initialDauthState = {
@@ -457,10 +254,10 @@ function getClientBasePath() {
457
254
  }
458
255
 
459
256
  var getUserAPI = /*#__PURE__*/function () {
460
- var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(domainName, token) {
257
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(domainName, token) {
461
258
  var params, response, data;
462
- return _regeneratorRuntime().wrap(function _callee$(_context) {
463
- while (1) switch (_context.prev = _context.next) {
259
+ return _regenerator().w(function (_context) {
260
+ while (1) switch (_context.n) {
464
261
  case 0:
465
262
  params = {
466
263
  method: 'GET',
@@ -469,21 +266,18 @@ var getUserAPI = /*#__PURE__*/function () {
469
266
  'Content-Type': 'application/json'
470
267
  }
471
268
  };
472
- _context.next = 3;
269
+ _context.n = 1;
473
270
  return fetch(getServerBasePath() + "/app/" + domainName + "/user", params);
474
- case 3:
475
- response = _context.sent;
476
- _context.next = 6;
271
+ case 1:
272
+ response = _context.v;
273
+ _context.n = 2;
477
274
  return response.json();
478
- case 6:
479
- data = _context.sent;
480
- return _context.abrupt("return", {
275
+ case 2:
276
+ data = _context.v;
277
+ return _context.a(2, {
481
278
  response: response,
482
279
  data: data
483
280
  });
484
- case 8:
485
- case "end":
486
- return _context.stop();
487
281
  }
488
282
  }, _callee);
489
283
  }));
@@ -492,10 +286,10 @@ var getUserAPI = /*#__PURE__*/function () {
492
286
  };
493
287
  }();
494
288
  var updateUserAPI = /*#__PURE__*/function () {
495
- var _ref2 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(domainName, user, token) {
289
+ var _ref2 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(domainName, user, token) {
496
290
  var params, response, data;
497
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
498
- while (1) switch (_context2.prev = _context2.next) {
291
+ return _regenerator().w(function (_context2) {
292
+ while (1) switch (_context2.n) {
499
293
  case 0:
500
294
  params = {
501
295
  method: 'PATCH',
@@ -505,21 +299,18 @@ var updateUserAPI = /*#__PURE__*/function () {
505
299
  },
506
300
  body: JSON.stringify(user)
507
301
  };
508
- _context2.next = 3;
302
+ _context2.n = 1;
509
303
  return fetch(getServerBasePath() + "/app/" + domainName + "/user", params);
510
- case 3:
511
- response = _context2.sent;
512
- _context2.next = 6;
304
+ case 1:
305
+ response = _context2.v;
306
+ _context2.n = 2;
513
307
  return response.json();
514
- case 6:
515
- data = _context2.sent;
516
- return _context2.abrupt("return", {
308
+ case 2:
309
+ data = _context2.v;
310
+ return _context2.a(2, {
517
311
  response: response,
518
312
  data: data
519
313
  });
520
- case 8:
521
- case "end":
522
- return _context2.stop();
523
314
  }
524
315
  }, _callee2);
525
316
  }));
@@ -528,10 +319,10 @@ var updateUserAPI = /*#__PURE__*/function () {
528
319
  };
529
320
  }();
530
321
  var sendEmailVerificationAPI = /*#__PURE__*/function () {
531
- var _ref3 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(domainName, token) {
322
+ var _ref3 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(domainName, token) {
532
323
  var params, response, data;
533
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
534
- while (1) switch (_context3.prev = _context3.next) {
324
+ return _regenerator().w(function (_context3) {
325
+ while (1) switch (_context3.n) {
535
326
  case 0:
536
327
  params = {
537
328
  method: 'GET',
@@ -540,21 +331,18 @@ var sendEmailVerificationAPI = /*#__PURE__*/function () {
540
331
  'Content-Type': 'application/json'
541
332
  }
542
333
  };
543
- _context3.next = 3;
334
+ _context3.n = 1;
544
335
  return fetch(getServerBasePath() + "/app/" + domainName + "/resend-email-verification", params);
545
- case 3:
546
- response = _context3.sent;
547
- _context3.next = 6;
336
+ case 1:
337
+ response = _context3.v;
338
+ _context3.n = 2;
548
339
  return response.json();
549
- case 6:
550
- data = _context3.sent;
551
- return _context3.abrupt("return", {
340
+ case 2:
341
+ data = _context3.v;
342
+ return _context3.a(2, {
552
343
  response: response,
553
344
  data: data
554
345
  });
555
- case 8:
556
- case "end":
557
- return _context3.stop();
558
346
  }
559
347
  }, _callee3);
560
348
  }));
@@ -563,10 +351,10 @@ var sendEmailVerificationAPI = /*#__PURE__*/function () {
563
351
  };
564
352
  }();
565
353
  var refreshAccessTokenAPI = /*#__PURE__*/function () {
566
- var _ref4 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(domainName, token) {
354
+ var _ref4 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(domainName, token) {
567
355
  var params, response, data;
568
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
569
- while (1) switch (_context4.prev = _context4.next) {
356
+ return _regenerator().w(function (_context4) {
357
+ while (1) switch (_context4.n) {
570
358
  case 0:
571
359
  params = {
572
360
  method: 'GET',
@@ -575,21 +363,18 @@ var refreshAccessTokenAPI = /*#__PURE__*/function () {
575
363
  'Content-Type': 'application/json'
576
364
  }
577
365
  };
578
- _context4.next = 3;
366
+ _context4.n = 1;
579
367
  return fetch(getServerBasePath() + "/app/" + domainName + "/refresh-access-token", params);
580
- case 3:
581
- response = _context4.sent;
582
- _context4.next = 6;
368
+ case 1:
369
+ response = _context4.v;
370
+ _context4.n = 2;
583
371
  return response.json();
584
- case 6:
585
- data = _context4.sent;
586
- return _context4.abrupt("return", {
372
+ case 2:
373
+ data = _context4.v;
374
+ return _context4.a(2, {
587
375
  response: response,
588
376
  data: data
589
377
  });
590
- case 8:
591
- case "end":
592
- return _context4.stop();
593
378
  }
594
379
  }, _callee4);
595
380
  }));
@@ -598,10 +383,10 @@ var refreshAccessTokenAPI = /*#__PURE__*/function () {
598
383
  };
599
384
  }();
600
385
  var verifyTokenAPI = /*#__PURE__*/function () {
601
- var _ref6 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref5) {
386
+ var _ref6 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(_ref5) {
602
387
  var domainName, tsk, token, params, response, data;
603
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
604
- while (1) switch (_context5.prev = _context5.next) {
388
+ return _regenerator().w(function (_context5) {
389
+ while (1) switch (_context5.n) {
605
390
  case 0:
606
391
  domainName = _ref5.domainName, tsk = _ref5.tsk, token = _ref5.token;
607
392
  params = {
@@ -614,25 +399,22 @@ var verifyTokenAPI = /*#__PURE__*/function () {
614
399
  tsk: tsk
615
400
  })
616
401
  };
617
- _context5.next = 4;
402
+ _context5.n = 1;
618
403
  return fetch(getServerBasePath() + "/app/" + domainName + "/verify-token", params);
619
- case 4:
620
- response = _context5.sent;
621
- _context5.next = 7;
404
+ case 1:
405
+ response = _context5.v;
406
+ _context5.n = 2;
622
407
  return response.json();
623
- case 7:
624
- data = _context5.sent;
625
- return _context5.abrupt("return", {
408
+ case 2:
409
+ data = _context5.v;
410
+ return _context5.a(2, {
626
411
  response: response,
627
412
  data: data
628
413
  });
629
- case 9:
630
- case "end":
631
- return _context5.stop();
632
414
  }
633
415
  }, _callee5);
634
416
  }));
635
- return function verifyTokenAPI(_x10) {
417
+ return function verifyTokenAPI(_x0) {
636
418
  return _ref6.apply(this, arguments);
637
419
  };
638
420
  }();
@@ -648,10 +430,10 @@ function setDauthStateAction(_x) {
648
430
  return _setDauthStateAction.apply(this, arguments);
649
431
  }
650
432
  function _setDauthStateAction() {
651
- _setDauthStateAction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
652
- var dispatch, token, domainName, getUserFetch;
653
- return _regeneratorRuntime().wrap(function _callee$(_context) {
654
- while (1) switch (_context.prev = _context.next) {
433
+ _setDauthStateAction = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(_ref) {
434
+ var dispatch, token, domainName, getUserFetch, _t;
435
+ return _regenerator().w(function (_context) {
436
+ while (1) switch (_context.p = _context.n) {
655
437
  case 0:
656
438
  dispatch = _ref.dispatch, token = _ref.token, domainName = _ref.domainName;
657
439
  dispatch({
@@ -660,13 +442,13 @@ function _setDauthStateAction() {
660
442
  isLoading: true
661
443
  }
662
444
  });
663
- _context.prev = 2;
664
- _context.next = 5;
445
+ _context.p = 1;
446
+ _context.n = 2;
665
447
  return getUserAPI(domainName, token);
666
- case 5:
667
- getUserFetch = _context.sent;
448
+ case 2:
449
+ getUserFetch = _context.v;
668
450
  if (!(getUserFetch.response.status === 200)) {
669
- _context.next = 12;
451
+ _context.n = 3;
670
452
  break;
671
453
  }
672
454
  dispatch({
@@ -677,32 +459,31 @@ function _setDauthStateAction() {
677
459
  isAuthenticated: true
678
460
  }
679
461
  });
680
- window.history.replaceState({}, document.title, getUserFetch.data.domain.loginRedirect);
681
- return _context.abrupt("return", localStorage.setItem(TOKEN_LS, token));
682
- case 12:
683
- return _context.abrupt("return", resetUser(dispatch));
684
- case 13:
685
- _context.next = 19;
462
+ window.history.replaceState({}, document.title, window.location.pathname);
463
+ return _context.a(2, localStorage.setItem(TOKEN_LS, token));
464
+ case 3:
465
+ return _context.a(2, resetUser(dispatch));
466
+ case 4:
467
+ _context.n = 6;
686
468
  break;
687
- case 15:
688
- _context.prev = 15;
689
- _context.t0 = _context["catch"](2);
690
- console.error(_context.t0);
691
- return _context.abrupt("return", resetUser(dispatch));
692
- case 19:
693
- _context.prev = 19;
469
+ case 5:
470
+ _context.p = 5;
471
+ _t = _context.v;
472
+ console.error(_t);
473
+ return _context.a(2, resetUser(dispatch));
474
+ case 6:
475
+ _context.p = 6;
694
476
  dispatch({
695
477
  type: SET_IS_LOADING,
696
478
  payload: {
697
479
  isLoading: false
698
480
  }
699
481
  });
700
- return _context.finish(19);
701
- case 22:
702
- case "end":
703
- return _context.stop();
482
+ return _context.f(6);
483
+ case 7:
484
+ return _context.a(2);
704
485
  }
705
- }, _callee, null, [[2, 15, 19, 22]]);
486
+ }, _callee, null, [[1, 5, 6, 7]]);
706
487
  }));
707
488
  return _setDauthStateAction.apply(this, arguments);
708
489
  }
@@ -710,10 +491,10 @@ function setAutoLoginAction(_x2) {
710
491
  return _setAutoLoginAction.apply(this, arguments);
711
492
  }
712
493
  function _setAutoLoginAction() {
713
- _setAutoLoginAction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
714
- var dispatch, token_ls, domainName, refreshAccessTokenFetch, newToken, getUserFetch;
715
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
716
- while (1) switch (_context2.prev = _context2.next) {
494
+ _setAutoLoginAction = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref2) {
495
+ var dispatch, token_ls, domainName, refreshAccessTokenFetch, newToken, getUserFetch, _t2;
496
+ return _regenerator().w(function (_context2) {
497
+ while (1) switch (_context2.p = _context2.n) {
717
498
  case 0:
718
499
  dispatch = _ref2.dispatch, token_ls = _ref2.token_ls, domainName = _ref2.domainName;
719
500
  dispatch({
@@ -722,22 +503,22 @@ function _setAutoLoginAction() {
722
503
  isLoading: true
723
504
  }
724
505
  });
725
- _context2.prev = 2;
726
- _context2.next = 5;
506
+ _context2.p = 1;
507
+ _context2.n = 2;
727
508
  return refreshAccessTokenAPI(domainName, token_ls);
728
- case 5:
729
- refreshAccessTokenFetch = _context2.sent;
509
+ case 2:
510
+ refreshAccessTokenFetch = _context2.v;
730
511
  if (!(refreshAccessTokenFetch.response.status === 200)) {
731
- _context2.next = 21;
512
+ _context2.n = 6;
732
513
  break;
733
514
  }
734
515
  newToken = refreshAccessTokenFetch.data.accessToken || token_ls;
735
- _context2.next = 10;
516
+ _context2.n = 3;
736
517
  return getUserAPI(domainName, newToken);
737
- case 10:
738
- getUserFetch = _context2.sent;
518
+ case 3:
519
+ getUserFetch = _context2.v;
739
520
  if (!(getUserFetch.response.status === 200)) {
740
- _context2.next = 17;
521
+ _context2.n = 4;
741
522
  break;
742
523
  }
743
524
  dispatch({
@@ -749,38 +530,37 @@ function _setAutoLoginAction() {
749
530
  }
750
531
  });
751
532
  localStorage.setItem(TOKEN_LS, refreshAccessTokenFetch.data.accessToken);
752
- return _context2.abrupt("return");
753
- case 17:
533
+ return _context2.a(2);
534
+ case 4:
754
535
  window.location.replace(getClientBasePath() + "/" + domainName + "/" + routes.signin);
755
- return _context2.abrupt("return", resetUser(dispatch));
756
- case 19:
757
- _context2.next = 23;
536
+ return _context2.a(2, resetUser(dispatch));
537
+ case 5:
538
+ _context2.n = 7;
758
539
  break;
759
- case 21:
540
+ case 6:
760
541
  window.location.replace(getClientBasePath() + "/" + domainName + "/" + routes.signin);
761
- return _context2.abrupt("return", resetUser(dispatch));
762
- case 23:
763
- _context2.next = 29;
542
+ return _context2.a(2, resetUser(dispatch));
543
+ case 7:
544
+ _context2.n = 9;
764
545
  break;
765
- case 25:
766
- _context2.prev = 25;
767
- _context2.t0 = _context2["catch"](2);
768
- console.error(_context2.t0);
769
- return _context2.abrupt("return", resetUser(dispatch));
770
- case 29:
771
- _context2.prev = 29;
546
+ case 8:
547
+ _context2.p = 8;
548
+ _t2 = _context2.v;
549
+ console.error(_t2);
550
+ return _context2.a(2, resetUser(dispatch));
551
+ case 9:
552
+ _context2.p = 9;
772
553
  dispatch({
773
554
  type: SET_IS_LOADING,
774
555
  payload: {
775
556
  isLoading: false
776
557
  }
777
558
  });
778
- return _context2.finish(29);
779
- case 32:
780
- case "end":
781
- return _context2.stop();
559
+ return _context2.f(9);
560
+ case 10:
561
+ return _context2.a(2);
782
562
  }
783
- }, _callee2, null, [[2, 25, 29, 32]]);
563
+ }, _callee2, null, [[1, 8, 9, 10]]);
784
564
  }));
785
565
  return _setAutoLoginAction.apply(this, arguments);
786
566
  }
@@ -814,55 +594,54 @@ function setUpdateUserAction(_x3) {
814
594
  return _setUpdateUserAction.apply(this, arguments);
815
595
  }
816
596
  function _setUpdateUserAction() {
817
- _setUpdateUserAction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
818
- var dispatch, domainName, user, token, getUserFetch;
819
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
820
- while (1) switch (_context3.prev = _context3.next) {
597
+ _setUpdateUserAction = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(_ref4) {
598
+ var dispatch, domainName, user, token, getUserFetch, _t3;
599
+ return _regenerator().w(function (_context3) {
600
+ while (1) switch (_context3.p = _context3.n) {
821
601
  case 0:
822
602
  dispatch = _ref4.dispatch, domainName = _ref4.domainName, user = _ref4.user, token = _ref4.token;
823
603
  if (user.language) {
824
604
  window.document.documentElement.setAttribute('lang', user.language);
825
605
  }
826
606
  if (token) {
827
- _context3.next = 5;
607
+ _context3.n = 1;
828
608
  break;
829
609
  }
830
610
  dispatch({
831
611
  type: UPDATE_USER,
832
612
  payload: user
833
613
  });
834
- return _context3.abrupt("return", false);
835
- case 5:
836
- _context3.prev = 5;
837
- _context3.next = 8;
614
+ return _context3.a(2, false);
615
+ case 1:
616
+ _context3.p = 1;
617
+ _context3.n = 2;
838
618
  return updateUserAPI(domainName, user, token);
839
- case 8:
840
- getUserFetch = _context3.sent;
619
+ case 2:
620
+ getUserFetch = _context3.v;
841
621
  if (!(getUserFetch.response.status === 200)) {
842
- _context3.next = 14;
622
+ _context3.n = 3;
843
623
  break;
844
624
  }
845
625
  dispatch({
846
626
  type: UPDATE_USER,
847
627
  payload: getUserFetch.data.user
848
628
  });
849
- return _context3.abrupt("return", true);
850
- case 14:
629
+ return _context3.a(2, true);
630
+ case 3:
851
631
  console.error('Update user error', getUserFetch.data.message);
852
- return _context3.abrupt("return", false);
853
- case 16:
854
- _context3.next = 22;
632
+ return _context3.a(2, false);
633
+ case 4:
634
+ _context3.n = 6;
855
635
  break;
856
- case 18:
857
- _context3.prev = 18;
858
- _context3.t0 = _context3["catch"](5);
859
- console.error('Update user error', _context3.t0);
860
- return _context3.abrupt("return", false);
861
- case 22:
862
- case "end":
863
- return _context3.stop();
636
+ case 5:
637
+ _context3.p = 5;
638
+ _t3 = _context3.v;
639
+ console.error('Update user error', _t3);
640
+ return _context3.a(2, false);
641
+ case 6:
642
+ return _context3.a(2);
864
643
  }
865
- }, _callee3, null, [[5, 18]]);
644
+ }, _callee3, null, [[1, 5]]);
866
645
  }));
867
646
  return _setUpdateUserAction.apply(this, arguments);
868
647
  }
@@ -870,10 +649,10 @@ function sendEmailVerificationAction(_x4) {
870
649
  return _sendEmailVerificationAction.apply(this, arguments);
871
650
  }
872
651
  function _sendEmailVerificationAction() {
873
- _sendEmailVerificationAction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref5) {
652
+ _sendEmailVerificationAction = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(_ref5) {
874
653
  var dispatch, domainName, token, sendEmailFetch;
875
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
876
- while (1) switch (_context4.prev = _context4.next) {
654
+ return _regenerator().w(function (_context4) {
655
+ while (1) switch (_context4.p = _context4.n) {
877
656
  case 0:
878
657
  dispatch = _ref5.dispatch, domainName = _ref5.domainName, token = _ref5.token;
879
658
  dispatch({
@@ -887,13 +666,13 @@ function _sendEmailVerificationAction() {
887
666
  message: 'Sending email verification...'
888
667
  }
889
668
  });
890
- _context4.prev = 3;
891
- _context4.next = 6;
669
+ _context4.p = 1;
670
+ _context4.n = 2;
892
671
  return sendEmailVerificationAPI(domainName, token);
893
- case 6:
894
- sendEmailFetch = _context4.sent;
672
+ case 2:
673
+ sendEmailFetch = _context4.v;
895
674
  if (!(sendEmailFetch.response.status === 200)) {
896
- _context4.next = 13;
675
+ _context4.n = 3;
897
676
  break;
898
677
  }
899
678
  dispatch({
@@ -907,8 +686,8 @@ function _sendEmailVerificationAction() {
907
686
  type: SET_SEND_EMAIL_VERIFICATION_IS_LOADING,
908
687
  payload: false
909
688
  });
910
- return _context4.abrupt("return", true);
911
- case 13:
689
+ return _context4.a(2, true);
690
+ case 3:
912
691
  dispatch({
913
692
  type: SET_SEND_EMAIL_VERIFICATION_STATUS,
914
693
  payload: {
@@ -920,13 +699,12 @@ function _sendEmailVerificationAction() {
920
699
  type: SET_SEND_EMAIL_VERIFICATION_IS_LOADING,
921
700
  payload: false
922
701
  });
923
- return _context4.abrupt("return", false);
924
- case 16:
925
- _context4.next = 23;
702
+ return _context4.a(2, false);
703
+ case 4:
704
+ _context4.n = 6;
926
705
  break;
927
- case 18:
928
- _context4.prev = 18;
929
- _context4.t0 = _context4["catch"](3);
706
+ case 5:
707
+ _context4.p = 5;
930
708
  dispatch({
931
709
  type: SET_SEND_EMAIL_VERIFICATION_STATUS,
932
710
  payload: {
@@ -938,12 +716,11 @@ function _sendEmailVerificationAction() {
938
716
  type: SET_SEND_EMAIL_VERIFICATION_IS_LOADING,
939
717
  payload: false
940
718
  });
941
- return _context4.abrupt("return", false);
942
- case 23:
943
- case "end":
944
- return _context4.stop();
719
+ return _context4.a(2, false);
720
+ case 6:
721
+ return _context4.a(2);
945
722
  }
946
- }, _callee4, null, [[3, 18]]);
723
+ }, _callee4, null, [[1, 5]]);
947
724
  }));
948
725
  return _sendEmailVerificationAction.apply(this, arguments);
949
726
  }
@@ -951,41 +728,40 @@ function checkTokenAction(_x5) {
951
728
  return _checkTokenAction.apply(this, arguments);
952
729
  }
953
730
  function _checkTokenAction() {
954
- _checkTokenAction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref6) {
955
- var dispatch, domainName, token, refreshAccessTokenFetch;
956
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
957
- while (1) switch (_context5.prev = _context5.next) {
731
+ _checkTokenAction = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(_ref6) {
732
+ var dispatch, domainName, token, refreshAccessTokenFetch, _t5;
733
+ return _regenerator().w(function (_context5) {
734
+ while (1) switch (_context5.p = _context5.n) {
958
735
  case 0:
959
736
  dispatch = _ref6.dispatch, domainName = _ref6.domainName, token = _ref6.token;
960
- _context5.prev = 1;
961
- _context5.next = 4;
737
+ _context5.p = 1;
738
+ _context5.n = 2;
962
739
  return refreshAccessTokenAPI(domainName, token);
963
- case 4:
964
- refreshAccessTokenFetch = _context5.sent;
740
+ case 2:
741
+ refreshAccessTokenFetch = _context5.v;
965
742
  if (!(refreshAccessTokenFetch.response.status === 200)) {
966
- _context5.next = 10;
743
+ _context5.n = 3;
967
744
  break;
968
745
  }
969
746
  if (refreshAccessTokenFetch.data.accessToken) {
970
747
  localStorage.setItem(TOKEN_LS, refreshAccessTokenFetch.data.accessToken);
971
748
  }
972
- return _context5.abrupt("return");
973
- case 10:
749
+ return _context5.a(2);
750
+ case 3:
974
751
  window.location.replace(getClientBasePath() + "/" + domainName + "/" + routes.signin);
975
- return _context5.abrupt("return", resetUser(dispatch));
976
- case 12:
977
- _context5.next = 18;
752
+ return _context5.a(2, resetUser(dispatch));
753
+ case 4:
754
+ _context5.n = 6;
978
755
  break;
979
- case 14:
980
- _context5.prev = 14;
981
- _context5.t0 = _context5["catch"](1);
756
+ case 5:
757
+ _context5.p = 5;
758
+ _t5 = _context5.v;
982
759
  resetUser(dispatch);
983
- throw _context5.t0;
984
- case 18:
985
- case "end":
986
- return _context5.stop();
760
+ throw _t5;
761
+ case 6:
762
+ return _context5.a(2);
987
763
  }
988
- }, _callee5, null, [[1, 14]]);
764
+ }, _callee5, null, [[1, 5]]);
989
765
  }));
990
766
  return _checkTokenAction.apply(this, arguments);
991
767
  }
@@ -995,45 +771,44 @@ function getAccessTokenAction(_x6) {
995
771
  ///////////////////////////////////////////
996
772
  //////////////////////////////////////////
997
773
  function _getAccessTokenAction() {
998
- _getAccessTokenAction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref7) {
999
- var dispatch, domainName, token_ls, refreshAccessTokenFetch, _refreshAccessTokenFe;
1000
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1001
- while (1) switch (_context6.prev = _context6.next) {
774
+ _getAccessTokenAction = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(_ref7) {
775
+ var dispatch, domainName, token_ls, refreshAccessTokenFetch, _refreshAccessTokenFe, _t6;
776
+ return _regenerator().w(function (_context6) {
777
+ while (1) switch (_context6.p = _context6.n) {
1002
778
  case 0:
1003
779
  dispatch = _ref7.dispatch, domainName = _ref7.domainName;
1004
780
  token_ls = localStorage.getItem(TOKEN_LS);
1005
781
  if (token_ls) {
1006
- _context6.next = 4;
782
+ _context6.n = 1;
1007
783
  break;
1008
784
  }
1009
- return _context6.abrupt("return");
1010
- case 4:
1011
- _context6.prev = 4;
1012
- _context6.next = 7;
785
+ return _context6.a(2);
786
+ case 1:
787
+ _context6.p = 1;
788
+ _context6.n = 2;
1013
789
  return refreshAccessTokenAPI(domainName, token_ls);
1014
- case 7:
1015
- refreshAccessTokenFetch = _context6.sent;
790
+ case 2:
791
+ refreshAccessTokenFetch = _context6.v;
1016
792
  if (!(refreshAccessTokenFetch.response.status === 200)) {
1017
- _context6.next = 12;
793
+ _context6.n = 3;
1018
794
  break;
1019
795
  }
1020
- return _context6.abrupt("return", (_refreshAccessTokenFe = refreshAccessTokenFetch.data.accessToken) != null ? _refreshAccessTokenFe : token_ls);
1021
- case 12:
796
+ return _context6.a(2, (_refreshAccessTokenFe = refreshAccessTokenFetch.data.accessToken) != null ? _refreshAccessTokenFe : token_ls);
797
+ case 3:
1022
798
  resetUser(dispatch);
1023
- return _context6.abrupt("return", 'token-not-found');
1024
- case 14:
1025
- _context6.next = 20;
799
+ return _context6.a(2, 'token-not-found');
800
+ case 4:
801
+ _context6.n = 6;
1026
802
  break;
1027
- case 16:
1028
- _context6.prev = 16;
1029
- _context6.t0 = _context6["catch"](4);
803
+ case 5:
804
+ _context6.p = 5;
805
+ _t6 = _context6.v;
1030
806
  resetUser(dispatch);
1031
- throw _context6.t0;
1032
- case 20:
1033
- case "end":
1034
- return _context6.stop();
807
+ throw _t6;
808
+ case 6:
809
+ return _context6.a(2);
1035
810
  }
1036
- }, _callee6, null, [[4, 16]]);
811
+ }, _callee6, null, [[1, 5]]);
1037
812
  }));
1038
813
  return _getAccessTokenAction.apply(this, arguments);
1039
814
  }
@@ -1056,37 +831,33 @@ var DauthProvider = function DauthProvider(props) {
1056
831
  var _useReducer = useReducer(userReducer, initialDauthState),
1057
832
  dauthState = _useReducer[0],
1058
833
  dispatch = _useReducer[1];
1059
- var isValidTsk = useCallback( /*#__PURE__*/function () {
1060
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(token) {
834
+ var isValidTsk = useCallback(/*#__PURE__*/function () {
835
+ var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(token) {
1061
836
  var verifyToken;
1062
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1063
- while (1) switch (_context.prev = _context.next) {
837
+ return _regenerator().w(function (_context) {
838
+ while (1) switch (_context.p = _context.n) {
1064
839
  case 0:
1065
- _context.prev = 0;
1066
- _context.next = 3;
840
+ _context.p = 0;
841
+ _context.n = 1;
1067
842
  return verifyTokenAPI({
1068
843
  domainName: domainName,
1069
844
  token: token,
1070
845
  tsk: tsk
1071
846
  });
1072
- case 3:
1073
- verifyToken = _context.sent;
847
+ case 1:
848
+ verifyToken = _context.v;
1074
849
  if (!(verifyToken.response.status !== 200)) {
1075
- _context.next = 6;
850
+ _context.n = 2;
1076
851
  break;
1077
852
  }
1078
- return _context.abrupt("return", false);
1079
- case 6:
1080
- return _context.abrupt("return", true);
1081
- case 9:
1082
- _context.prev = 9;
1083
- _context.t0 = _context["catch"](0);
1084
- return _context.abrupt("return", false);
1085
- case 12:
1086
- case "end":
1087
- return _context.stop();
853
+ return _context.a(2, false);
854
+ case 2:
855
+ return _context.a(2, true);
856
+ case 3:
857
+ _context.p = 3;
858
+ return _context.a(2, false);
1088
859
  }
1089
- }, _callee, null, [[0, 9]]);
860
+ }, _callee, null, [[0, 3]]);
1090
861
  }));
1091
862
  return function (_x) {
1092
863
  return _ref.apply(this, arguments);
@@ -1095,39 +866,38 @@ var DauthProvider = function DauthProvider(props) {
1095
866
  // Check token periodically
1096
867
  useEffect(function () {
1097
868
  if (!dauthState.isAuthenticated) return;
1098
- var interval = setInterval( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
869
+ var interval = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
1099
870
  var token_ls, isValid;
1100
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1101
- while (1) switch (_context2.prev = _context2.next) {
871
+ return _regenerator().w(function (_context2) {
872
+ while (1) switch (_context2.n) {
1102
873
  case 0:
1103
874
  token_ls = localStorage.getItem(TOKEN_LS);
1104
875
  if (token_ls) {
1105
- _context2.next = 3;
876
+ _context2.n = 1;
1106
877
  break;
1107
878
  }
1108
- return _context2.abrupt("return");
1109
- case 3:
1110
- _context2.next = 5;
879
+ return _context2.a(2);
880
+ case 1:
881
+ _context2.n = 2;
1111
882
  return isValidTsk(token_ls);
1112
- case 5:
1113
- isValid = _context2.sent;
883
+ case 2:
884
+ isValid = _context2.v;
1114
885
  if (!isValid) {
1115
- _context2.next = 10;
886
+ _context2.n = 3;
1116
887
  break;
1117
888
  }
1118
- return _context2.abrupt("return", checkTokenAction({
889
+ return _context2.a(2, checkTokenAction({
1119
890
  dispatch: dispatch,
1120
891
  domainName: domainName,
1121
892
  token: token_ls
1122
893
  }));
1123
- case 10:
894
+ case 3:
1124
895
  setLogoutAction({
1125
896
  dispatch: dispatch
1126
897
  });
1127
898
  throw new Error('Ask value in DauthProvider is not valid');
1128
- case 12:
1129
- case "end":
1130
- return _context2.stop();
899
+ case 4:
900
+ return _context2.a(2);
1131
901
  }
1132
902
  }, _callee2);
1133
903
  })), 1000 * 60 * 5);
@@ -1137,92 +907,90 @@ var DauthProvider = function DauthProvider(props) {
1137
907
  }, [dauthState.isAuthenticated, isValidTsk]);
1138
908
  // Catch login redirect
1139
909
  useEffect(function () {
1140
- _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
910
+ _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
1141
911
  var queryString, urlParams, token_url, isValid;
1142
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1143
- while (1) switch (_context3.prev = _context3.next) {
912
+ return _regenerator().w(function (_context3) {
913
+ while (1) switch (_context3.n) {
1144
914
  case 0:
1145
915
  queryString = window.location.search;
1146
916
  if (queryString) {
1147
- _context3.next = 3;
917
+ _context3.n = 1;
1148
918
  break;
1149
919
  }
1150
- return _context3.abrupt("return");
1151
- case 3:
920
+ return _context3.a(2);
921
+ case 1:
1152
922
  urlParams = new URLSearchParams(queryString);
1153
923
  token_url = urlParams.get(TOKEN_LS);
1154
924
  if (!(token_url && !dauthState.isAuthenticated)) {
1155
- _context3.next = 15;
925
+ _context3.n = 4;
1156
926
  break;
1157
927
  }
1158
- _context3.next = 8;
928
+ _context3.n = 2;
1159
929
  return isValidTsk(token_url);
1160
- case 8:
1161
- isValid = _context3.sent;
930
+ case 2:
931
+ isValid = _context3.v;
1162
932
  if (!isValid) {
1163
- _context3.next = 13;
933
+ _context3.n = 3;
1164
934
  break;
1165
935
  }
1166
- return _context3.abrupt("return", setDauthStateAction({
936
+ return _context3.a(2, setDauthStateAction({
1167
937
  dispatch: dispatch,
1168
938
  token: token_url,
1169
939
  domainName: domainName
1170
940
  }));
1171
- case 13:
941
+ case 3:
1172
942
  setLogoutAction({
1173
943
  dispatch: dispatch
1174
944
  });
1175
945
  throw new Error('Ask value in DauthProvider is not valid');
1176
- case 15:
1177
- case "end":
1178
- return _context3.stop();
946
+ case 4:
947
+ return _context3.a(2);
1179
948
  }
1180
949
  }, _callee3);
1181
950
  }))();
1182
951
  }, []);
1183
952
  // Auto Login
1184
953
  useEffect(function () {
1185
- _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
954
+ _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
1186
955
  var token_ls, isValid;
1187
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1188
- while (1) switch (_context4.prev = _context4.next) {
956
+ return _regenerator().w(function (_context4) {
957
+ while (1) switch (_context4.n) {
1189
958
  case 0:
1190
959
  token_ls = localStorage.getItem(TOKEN_LS);
1191
960
  if (!(token_ls && !dauthState.isAuthenticated)) {
1192
- _context4.next = 13;
961
+ _context4.n = 4;
1193
962
  break;
1194
963
  }
1195
- _context4.next = 4;
964
+ _context4.n = 1;
1196
965
  return isValidTsk(token_ls);
1197
- case 4:
1198
- isValid = _context4.sent;
966
+ case 1:
967
+ isValid = _context4.v;
1199
968
  if (!isValid) {
1200
- _context4.next = 9;
969
+ _context4.n = 2;
1201
970
  break;
1202
971
  }
1203
- return _context4.abrupt("return", setAutoLoginAction({
972
+ return _context4.a(2, setAutoLoginAction({
1204
973
  dispatch: dispatch,
1205
974
  token_ls: token_ls,
1206
975
  domainName: domainName
1207
976
  }));
1208
- case 9:
977
+ case 2:
1209
978
  setLogoutAction({
1210
979
  dispatch: dispatch
1211
980
  });
1212
981
  throw new Error('Ask value in DauthProvider is not valid');
1213
- case 11:
1214
- _context4.next = 14;
982
+ case 3:
983
+ _context4.n = 5;
1215
984
  break;
1216
- case 13:
1217
- return _context4.abrupt("return", dispatch({
985
+ case 4:
986
+ return _context4.a(2, dispatch({
1218
987
  type: SET_IS_LOADING,
1219
988
  payload: {
1220
989
  isLoading: false
1221
990
  }
1222
991
  }));
1223
- case 14:
1224
- case "end":
1225
- return _context4.stop();
992
+ case 5:
993
+ return _context4.a(2);
1226
994
  }
1227
995
  }, _callee4);
1228
996
  }))();
@@ -1235,30 +1003,27 @@ var DauthProvider = function DauthProvider(props) {
1235
1003
  dispatch: dispatch
1236
1004
  });
1237
1005
  }, []);
1238
- var getAccessToken = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
1006
+ var getAccessToken = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
1239
1007
  var token;
1240
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1241
- while (1) switch (_context5.prev = _context5.next) {
1008
+ return _regenerator().w(function (_context5) {
1009
+ while (1) switch (_context5.n) {
1242
1010
  case 0:
1243
- _context5.next = 2;
1011
+ _context5.n = 1;
1244
1012
  return getAccessTokenAction({
1245
1013
  dispatch: dispatch,
1246
1014
  domainName: domainName
1247
1015
  });
1248
- case 2:
1249
- token = _context5.sent;
1250
- return _context5.abrupt("return", token);
1251
- case 4:
1252
- case "end":
1253
- return _context5.stop();
1016
+ case 1:
1017
+ token = _context5.v;
1018
+ return _context5.a(2, token);
1254
1019
  }
1255
1020
  }, _callee5);
1256
1021
  })), [domainName]);
1257
- var updateUser = useCallback( /*#__PURE__*/function () {
1258
- var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref6) {
1022
+ var updateUser = useCallback(/*#__PURE__*/function () {
1023
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(_ref6) {
1259
1024
  var name, lastname, nickname, telPrefix, telSuffix, language, avatar, token_ls, user;
1260
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1261
- while (1) switch (_context6.prev = _context6.next) {
1025
+ return _regenerator().w(function (_context6) {
1026
+ while (1) switch (_context6.n) {
1262
1027
  case 0:
1263
1028
  name = _ref6.name, lastname = _ref6.lastname, nickname = _ref6.nickname, telPrefix = _ref6.telPrefix, telSuffix = _ref6.telSuffix, language = _ref6.language, avatar = _ref6.avatar;
1264
1029
  token_ls = localStorage.getItem(TOKEN_LS);
@@ -1271,18 +1036,15 @@ var DauthProvider = function DauthProvider(props) {
1271
1036
  language: language,
1272
1037
  avatar: avatar
1273
1038
  };
1274
- _context6.next = 5;
1039
+ _context6.n = 1;
1275
1040
  return setUpdateUserAction({
1276
1041
  dispatch: dispatch,
1277
1042
  domainName: domainName,
1278
1043
  user: user,
1279
1044
  token: token_ls
1280
1045
  });
1281
- case 5:
1282
- return _context6.abrupt("return", _context6.sent);
1283
- case 6:
1284
- case "end":
1285
- return _context6.stop();
1046
+ case 1:
1047
+ return _context6.a(2, _context6.v);
1286
1048
  }
1287
1049
  }, _callee6);
1288
1050
  }));
@@ -1295,29 +1057,26 @@ var DauthProvider = function DauthProvider(props) {
1295
1057
  if (!token_ls) return;
1296
1058
  return window.location.replace(getClientBasePath() + "/" + domainName + "/" + routes.updateUser + "/" + token_ls);
1297
1059
  }, [domainName]);
1298
- var sendEmailVerification = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
1060
+ var sendEmailVerification = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
1299
1061
  var token_ls;
1300
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1301
- while (1) switch (_context7.prev = _context7.next) {
1062
+ return _regenerator().w(function (_context7) {
1063
+ while (1) switch (_context7.n) {
1302
1064
  case 0:
1303
1065
  token_ls = localStorage.getItem(TOKEN_LS);
1304
1066
  if (token_ls) {
1305
- _context7.next = 3;
1067
+ _context7.n = 1;
1306
1068
  break;
1307
1069
  }
1308
- return _context7.abrupt("return", false);
1309
- case 3:
1310
- _context7.next = 5;
1070
+ return _context7.a(2, false);
1071
+ case 1:
1072
+ _context7.n = 2;
1311
1073
  return sendEmailVerificationAction({
1312
1074
  dispatch: dispatch,
1313
1075
  domainName: domainName,
1314
1076
  token: token_ls
1315
1077
  });
1316
- case 5:
1317
- return _context7.abrupt("return", _context7.sent);
1318
- case 6:
1319
- case "end":
1320
- return _context7.stop();
1078
+ case 2:
1079
+ return _context7.a(2, _context7.v);
1321
1080
  }
1322
1081
  }, _callee7);
1323
1082
  })), [domainName]);