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