dauth-context-react 1.0.1 → 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
- }
12
+ var i = n[a](c),
13
+ u = i.value;
14
+ } catch (n) {
15
+ return void e(n);
60
16
  }
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
- });
84
- }
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;
318
- }
319
- if (info.done) {
320
- resolve(value);
321
- } else {
322
- Promise.resolve(value).then(_next, _throw);
134
+ i({}, "", {});
135
+ } catch (e) {
136
+ i = 0;
323
137
  }
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 = {
@@ -448,30 +245,26 @@ function checkIsLocalhost() {
448
245
  var hostname = window.location.hostname;
449
246
  return Boolean(hostname === 'localhost' || hostname === '[::1]' || hostname.match(/(192)\.(168)\.(1)\.([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/gm) || hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));
450
247
  }
451
- function getServerBasePath(_ref) {
452
- var domainName = _ref.domainName;
248
+ function getServerBasePath() {
453
249
  var isLocalhost = checkIsLocalhost();
454
250
  var serverPort = 4012;
455
251
  var serverLocalUrl = window.location.protocol + "//" + window.location.hostname + ":" + serverPort + "/api/" + apiVersion;
456
- var serverProdUrl = "https://" + domainName + "." + serverDomain + "/api/" + apiVersion;
457
- var serverBasePath = isLocalhost ? serverLocalUrl : serverProdUrl;
458
- return serverBasePath;
252
+ var serverProdUrl = "https://" + serverDomain + "/api/" + apiVersion;
253
+ return isLocalhost ? serverLocalUrl : serverProdUrl;
459
254
  }
460
- function getClientBasePath(_ref2) {
461
- var domainName = _ref2.domainName;
255
+ function getClientBasePath() {
462
256
  var isLocalhost = checkIsLocalhost();
463
257
  var clientPort = 5185;
464
258
  var clientLocalUrl = window.location.protocol + "//" + window.location.hostname + ":" + clientPort;
465
- var clientProdUrl = "https://" + domainName + "." + serverDomain;
466
- var clientBasePath = isLocalhost ? clientLocalUrl : clientProdUrl;
467
- return clientBasePath;
259
+ var clientProdUrl = "https://" + serverDomain;
260
+ return isLocalhost ? clientLocalUrl : clientProdUrl;
468
261
  }
469
262
 
470
263
  var getUserAPI = /*#__PURE__*/function () {
471
- var _ref = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(domainName, token) {
264
+ var _ref = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(domainName, token) {
472
265
  var params, response, data;
473
- return _regeneratorRuntime().wrap(function _callee$(_context) {
474
- while (1) switch (_context.prev = _context.next) {
266
+ return _regenerator().w(function (_context) {
267
+ while (1) switch (_context.n) {
475
268
  case 0:
476
269
  params = {
477
270
  method: 'GET',
@@ -480,23 +273,18 @@ var getUserAPI = /*#__PURE__*/function () {
480
273
  'Content-Type': 'application/json'
481
274
  }
482
275
  };
483
- _context.next = 3;
484
- return fetch(getServerBasePath({
485
- domainName: domainName
486
- }) + "/tenant/" + domainName + "/user", params);
487
- case 3:
488
- response = _context.sent;
489
- _context.next = 6;
276
+ _context.n = 1;
277
+ return fetch(getServerBasePath() + "/app/" + domainName + "/user", params);
278
+ case 1:
279
+ response = _context.v;
280
+ _context.n = 2;
490
281
  return response.json();
491
- case 6:
492
- data = _context.sent;
493
- return _context.abrupt("return", {
282
+ case 2:
283
+ data = _context.v;
284
+ return _context.a(2, {
494
285
  response: response,
495
286
  data: data
496
287
  });
497
- case 8:
498
- case "end":
499
- return _context.stop();
500
288
  }
501
289
  }, _callee);
502
290
  }));
@@ -505,10 +293,10 @@ var getUserAPI = /*#__PURE__*/function () {
505
293
  };
506
294
  }();
507
295
  var updateUserAPI = /*#__PURE__*/function () {
508
- 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) {
509
297
  var params, response, data;
510
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
511
- while (1) switch (_context2.prev = _context2.next) {
298
+ return _regenerator().w(function (_context2) {
299
+ while (1) switch (_context2.n) {
512
300
  case 0:
513
301
  params = {
514
302
  method: 'PATCH',
@@ -518,23 +306,18 @@ var updateUserAPI = /*#__PURE__*/function () {
518
306
  },
519
307
  body: JSON.stringify(user)
520
308
  };
521
- _context2.next = 3;
522
- return fetch(getServerBasePath({
523
- domainName: domainName
524
- }) + "/tenant/" + domainName + "/user", params);
525
- case 3:
526
- response = _context2.sent;
527
- _context2.next = 6;
309
+ _context2.n = 1;
310
+ return fetch(getServerBasePath() + "/app/" + domainName + "/user", params);
311
+ case 1:
312
+ response = _context2.v;
313
+ _context2.n = 2;
528
314
  return response.json();
529
- case 6:
530
- data = _context2.sent;
531
- return _context2.abrupt("return", {
315
+ case 2:
316
+ data = _context2.v;
317
+ return _context2.a(2, {
532
318
  response: response,
533
319
  data: data
534
320
  });
535
- case 8:
536
- case "end":
537
- return _context2.stop();
538
321
  }
539
322
  }, _callee2);
540
323
  }));
@@ -543,10 +326,10 @@ var updateUserAPI = /*#__PURE__*/function () {
543
326
  };
544
327
  }();
545
328
  var sendEmailVerificationAPI = /*#__PURE__*/function () {
546
- var _ref3 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(domainName, token) {
329
+ var _ref3 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(domainName, token) {
547
330
  var params, response, data;
548
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
549
- while (1) switch (_context3.prev = _context3.next) {
331
+ return _regenerator().w(function (_context3) {
332
+ while (1) switch (_context3.n) {
550
333
  case 0:
551
334
  params = {
552
335
  method: 'GET',
@@ -555,23 +338,18 @@ var sendEmailVerificationAPI = /*#__PURE__*/function () {
555
338
  'Content-Type': 'application/json'
556
339
  }
557
340
  };
558
- _context3.next = 3;
559
- return fetch(getServerBasePath({
560
- domainName: domainName
561
- }) + "/tenant/" + domainName + "/resend-email-verification", params);
562
- case 3:
563
- response = _context3.sent;
564
- _context3.next = 6;
341
+ _context3.n = 1;
342
+ return fetch(getServerBasePath() + "/app/" + domainName + "/resend-email-verification", params);
343
+ case 1:
344
+ response = _context3.v;
345
+ _context3.n = 2;
565
346
  return response.json();
566
- case 6:
567
- data = _context3.sent;
568
- return _context3.abrupt("return", {
347
+ case 2:
348
+ data = _context3.v;
349
+ return _context3.a(2, {
569
350
  response: response,
570
351
  data: data
571
352
  });
572
- case 8:
573
- case "end":
574
- return _context3.stop();
575
353
  }
576
354
  }, _callee3);
577
355
  }));
@@ -580,10 +358,10 @@ var sendEmailVerificationAPI = /*#__PURE__*/function () {
580
358
  };
581
359
  }();
582
360
  var refreshAccessTokenAPI = /*#__PURE__*/function () {
583
- var _ref4 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(domainName, token) {
361
+ var _ref4 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(domainName, token) {
584
362
  var params, response, data;
585
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
586
- while (1) switch (_context4.prev = _context4.next) {
363
+ return _regenerator().w(function (_context4) {
364
+ while (1) switch (_context4.n) {
587
365
  case 0:
588
366
  params = {
589
367
  method: 'GET',
@@ -592,23 +370,18 @@ var refreshAccessTokenAPI = /*#__PURE__*/function () {
592
370
  'Content-Type': 'application/json'
593
371
  }
594
372
  };
595
- _context4.next = 3;
596
- return fetch(getServerBasePath({
597
- domainName: domainName
598
- }) + "/tenant/" + domainName + "/refresh-access-token", params);
599
- case 3:
600
- response = _context4.sent;
601
- _context4.next = 6;
373
+ _context4.n = 1;
374
+ return fetch(getServerBasePath() + "/app/" + domainName + "/refresh-access-token", params);
375
+ case 1:
376
+ response = _context4.v;
377
+ _context4.n = 2;
602
378
  return response.json();
603
- case 6:
604
- data = _context4.sent;
605
- return _context4.abrupt("return", {
379
+ case 2:
380
+ data = _context4.v;
381
+ return _context4.a(2, {
606
382
  response: response,
607
383
  data: data
608
384
  });
609
- case 8:
610
- case "end":
611
- return _context4.stop();
612
385
  }
613
386
  }, _callee4);
614
387
  }));
@@ -617,10 +390,10 @@ var refreshAccessTokenAPI = /*#__PURE__*/function () {
617
390
  };
618
391
  }();
619
392
  var verifyTokenAPI = /*#__PURE__*/function () {
620
- var _ref6 = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref5) {
393
+ var _ref6 = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(_ref5) {
621
394
  var domainName, tsk, token, params, response, data;
622
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
623
- while (1) switch (_context5.prev = _context5.next) {
395
+ return _regenerator().w(function (_context5) {
396
+ while (1) switch (_context5.n) {
624
397
  case 0:
625
398
  domainName = _ref5.domainName, tsk = _ref5.tsk, token = _ref5.token;
626
399
  params = {
@@ -633,27 +406,22 @@ var verifyTokenAPI = /*#__PURE__*/function () {
633
406
  tsk: tsk
634
407
  })
635
408
  };
636
- _context5.next = 4;
637
- return fetch(getServerBasePath({
638
- domainName: domainName
639
- }) + "/tenant/" + domainName + "/verify-token", params);
640
- case 4:
641
- response = _context5.sent;
642
- _context5.next = 7;
409
+ _context5.n = 1;
410
+ return fetch(getServerBasePath() + "/app/" + domainName + "/verify-token", params);
411
+ case 1:
412
+ response = _context5.v;
413
+ _context5.n = 2;
643
414
  return response.json();
644
- case 7:
645
- data = _context5.sent;
646
- return _context5.abrupt("return", {
415
+ case 2:
416
+ data = _context5.v;
417
+ return _context5.a(2, {
647
418
  response: response,
648
419
  data: data
649
420
  });
650
- case 9:
651
- case "end":
652
- return _context5.stop();
653
421
  }
654
422
  }, _callee5);
655
423
  }));
656
- return function verifyTokenAPI(_x10) {
424
+ return function verifyTokenAPI(_x0) {
657
425
  return _ref6.apply(this, arguments);
658
426
  };
659
427
  }();
@@ -669,10 +437,10 @@ function setDauthStateAction(_x) {
669
437
  return _setDauthStateAction.apply(this, arguments);
670
438
  }
671
439
  function _setDauthStateAction() {
672
- _setDauthStateAction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
673
- var dispatch, token, domainName, getUserFetch;
674
- return _regeneratorRuntime().wrap(function _callee$(_context) {
675
- 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) {
676
444
  case 0:
677
445
  dispatch = _ref.dispatch, token = _ref.token, domainName = _ref.domainName;
678
446
  dispatch({
@@ -681,13 +449,13 @@ function _setDauthStateAction() {
681
449
  isLoading: true
682
450
  }
683
451
  });
684
- _context.prev = 2;
685
- _context.next = 5;
452
+ _context.p = 1;
453
+ _context.n = 2;
686
454
  return getUserAPI(domainName, token);
687
- case 5:
688
- getUserFetch = _context.sent;
455
+ case 2:
456
+ getUserFetch = _context.v;
689
457
  if (!(getUserFetch.response.status === 200)) {
690
- _context.next = 12;
458
+ _context.n = 3;
691
459
  break;
692
460
  }
693
461
  dispatch({
@@ -698,32 +466,31 @@ function _setDauthStateAction() {
698
466
  isAuthenticated: true
699
467
  }
700
468
  });
701
- window.history.replaceState({}, document.title, getUserFetch.data.domain.loginRedirect);
702
- return _context.abrupt("return", localStorage.setItem(TOKEN_LS, token));
703
- case 12:
704
- return _context.abrupt("return", resetUser(dispatch));
705
- case 13:
706
- _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;
707
475
  break;
708
- case 15:
709
- _context.prev = 15;
710
- _context.t0 = _context["catch"](2);
711
- console.error(_context.t0);
712
- return _context.abrupt("return", resetUser(dispatch));
713
- case 19:
714
- _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;
715
483
  dispatch({
716
484
  type: SET_IS_LOADING,
717
485
  payload: {
718
486
  isLoading: false
719
487
  }
720
488
  });
721
- return _context.finish(19);
722
- case 22:
723
- case "end":
724
- return _context.stop();
489
+ return _context.f(6);
490
+ case 7:
491
+ return _context.a(2);
725
492
  }
726
- }, _callee, null, [[2, 15, 19, 22]]);
493
+ }, _callee, null, [[1, 5, 6, 7]]);
727
494
  }));
728
495
  return _setDauthStateAction.apply(this, arguments);
729
496
  }
@@ -731,10 +498,10 @@ function setAutoLoginAction(_x2) {
731
498
  return _setAutoLoginAction.apply(this, arguments);
732
499
  }
733
500
  function _setAutoLoginAction() {
734
- _setAutoLoginAction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
735
- var dispatch, token_ls, domainName, refreshAccessTokenFetch, newToken, getUserFetch;
736
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
737
- 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) {
738
505
  case 0:
739
506
  dispatch = _ref2.dispatch, token_ls = _ref2.token_ls, domainName = _ref2.domainName;
740
507
  dispatch({
@@ -743,22 +510,22 @@ function _setAutoLoginAction() {
743
510
  isLoading: true
744
511
  }
745
512
  });
746
- _context2.prev = 2;
747
- _context2.next = 5;
513
+ _context2.p = 1;
514
+ _context2.n = 2;
748
515
  return refreshAccessTokenAPI(domainName, token_ls);
749
- case 5:
750
- refreshAccessTokenFetch = _context2.sent;
516
+ case 2:
517
+ refreshAccessTokenFetch = _context2.v;
751
518
  if (!(refreshAccessTokenFetch.response.status === 200)) {
752
- _context2.next = 21;
519
+ _context2.n = 6;
753
520
  break;
754
521
  }
755
522
  newToken = refreshAccessTokenFetch.data.accessToken || token_ls;
756
- _context2.next = 10;
523
+ _context2.n = 3;
757
524
  return getUserAPI(domainName, newToken);
758
- case 10:
759
- getUserFetch = _context2.sent;
525
+ case 3:
526
+ getUserFetch = _context2.v;
760
527
  if (!(getUserFetch.response.status === 200)) {
761
- _context2.next = 17;
528
+ _context2.n = 4;
762
529
  break;
763
530
  }
764
531
  dispatch({
@@ -770,42 +537,37 @@ function _setAutoLoginAction() {
770
537
  }
771
538
  });
772
539
  localStorage.setItem(TOKEN_LS, refreshAccessTokenFetch.data.accessToken);
773
- return _context2.abrupt("return");
774
- case 17:
775
- window.location.replace(getClientBasePath({
776
- domainName: domainName
777
- }) + "/" + domainName + "/" + routes.signin);
778
- return _context2.abrupt("return", resetUser(dispatch));
779
- case 19:
780
- _context2.next = 23;
540
+ return _context2.a(2);
541
+ case 4:
542
+ window.location.replace(getClientBasePath() + "/" + domainName + "/" + routes.signin);
543
+ return _context2.a(2, resetUser(dispatch));
544
+ case 5:
545
+ _context2.n = 7;
781
546
  break;
782
- case 21:
783
- window.location.replace(getClientBasePath({
784
- domainName: domainName
785
- }) + "/" + domainName + "/" + routes.signin);
786
- return _context2.abrupt("return", resetUser(dispatch));
787
- case 23:
788
- _context2.next = 29;
547
+ case 6:
548
+ window.location.replace(getClientBasePath() + "/" + domainName + "/" + routes.signin);
549
+ return _context2.a(2, resetUser(dispatch));
550
+ case 7:
551
+ _context2.n = 9;
789
552
  break;
790
- case 25:
791
- _context2.prev = 25;
792
- _context2.t0 = _context2["catch"](2);
793
- console.error(_context2.t0);
794
- return _context2.abrupt("return", resetUser(dispatch));
795
- case 29:
796
- _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;
797
560
  dispatch({
798
561
  type: SET_IS_LOADING,
799
562
  payload: {
800
563
  isLoading: false
801
564
  }
802
565
  });
803
- return _context2.finish(29);
804
- case 32:
805
- case "end":
806
- return _context2.stop();
566
+ return _context2.f(9);
567
+ case 10:
568
+ return _context2.a(2);
807
569
  }
808
- }, _callee2, null, [[2, 25, 29, 32]]);
570
+ }, _callee2, null, [[1, 8, 9, 10]]);
809
571
  }));
810
572
  return _setAutoLoginAction.apply(this, arguments);
811
573
  }
@@ -839,55 +601,54 @@ function setUpdateUserAction(_x3) {
839
601
  return _setUpdateUserAction.apply(this, arguments);
840
602
  }
841
603
  function _setUpdateUserAction() {
842
- _setUpdateUserAction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
843
- var dispatch, domainName, user, token, getUserFetch;
844
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
845
- 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) {
846
608
  case 0:
847
609
  dispatch = _ref4.dispatch, domainName = _ref4.domainName, user = _ref4.user, token = _ref4.token;
848
610
  if (user.language) {
849
611
  window.document.documentElement.setAttribute('lang', user.language);
850
612
  }
851
613
  if (token) {
852
- _context3.next = 5;
614
+ _context3.n = 1;
853
615
  break;
854
616
  }
855
617
  dispatch({
856
618
  type: UPDATE_USER,
857
619
  payload: user
858
620
  });
859
- return _context3.abrupt("return", false);
860
- case 5:
861
- _context3.prev = 5;
862
- _context3.next = 8;
621
+ return _context3.a(2, false);
622
+ case 1:
623
+ _context3.p = 1;
624
+ _context3.n = 2;
863
625
  return updateUserAPI(domainName, user, token);
864
- case 8:
865
- getUserFetch = _context3.sent;
626
+ case 2:
627
+ getUserFetch = _context3.v;
866
628
  if (!(getUserFetch.response.status === 200)) {
867
- _context3.next = 14;
629
+ _context3.n = 3;
868
630
  break;
869
631
  }
870
632
  dispatch({
871
633
  type: UPDATE_USER,
872
634
  payload: getUserFetch.data.user
873
635
  });
874
- return _context3.abrupt("return", true);
875
- case 14:
636
+ return _context3.a(2, true);
637
+ case 3:
876
638
  console.error('Update user error', getUserFetch.data.message);
877
- return _context3.abrupt("return", false);
878
- case 16:
879
- _context3.next = 22;
639
+ return _context3.a(2, false);
640
+ case 4:
641
+ _context3.n = 6;
880
642
  break;
881
- case 18:
882
- _context3.prev = 18;
883
- _context3.t0 = _context3["catch"](5);
884
- console.error('Update user error', _context3.t0);
885
- return _context3.abrupt("return", false);
886
- case 22:
887
- case "end":
888
- 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);
889
650
  }
890
- }, _callee3, null, [[5, 18]]);
651
+ }, _callee3, null, [[1, 5]]);
891
652
  }));
892
653
  return _setUpdateUserAction.apply(this, arguments);
893
654
  }
@@ -895,10 +656,10 @@ function sendEmailVerificationAction(_x4) {
895
656
  return _sendEmailVerificationAction.apply(this, arguments);
896
657
  }
897
658
  function _sendEmailVerificationAction() {
898
- _sendEmailVerificationAction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref5) {
659
+ _sendEmailVerificationAction = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(_ref5) {
899
660
  var dispatch, domainName, token, sendEmailFetch;
900
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
901
- while (1) switch (_context4.prev = _context4.next) {
661
+ return _regenerator().w(function (_context4) {
662
+ while (1) switch (_context4.p = _context4.n) {
902
663
  case 0:
903
664
  dispatch = _ref5.dispatch, domainName = _ref5.domainName, token = _ref5.token;
904
665
  dispatch({
@@ -912,13 +673,13 @@ function _sendEmailVerificationAction() {
912
673
  message: 'Sending email verification...'
913
674
  }
914
675
  });
915
- _context4.prev = 3;
916
- _context4.next = 6;
676
+ _context4.p = 1;
677
+ _context4.n = 2;
917
678
  return sendEmailVerificationAPI(domainName, token);
918
- case 6:
919
- sendEmailFetch = _context4.sent;
679
+ case 2:
680
+ sendEmailFetch = _context4.v;
920
681
  if (!(sendEmailFetch.response.status === 200)) {
921
- _context4.next = 13;
682
+ _context4.n = 3;
922
683
  break;
923
684
  }
924
685
  dispatch({
@@ -932,8 +693,8 @@ function _sendEmailVerificationAction() {
932
693
  type: SET_SEND_EMAIL_VERIFICATION_IS_LOADING,
933
694
  payload: false
934
695
  });
935
- return _context4.abrupt("return", true);
936
- case 13:
696
+ return _context4.a(2, true);
697
+ case 3:
937
698
  dispatch({
938
699
  type: SET_SEND_EMAIL_VERIFICATION_STATUS,
939
700
  payload: {
@@ -945,13 +706,12 @@ function _sendEmailVerificationAction() {
945
706
  type: SET_SEND_EMAIL_VERIFICATION_IS_LOADING,
946
707
  payload: false
947
708
  });
948
- return _context4.abrupt("return", false);
949
- case 16:
950
- _context4.next = 23;
709
+ return _context4.a(2, false);
710
+ case 4:
711
+ _context4.n = 6;
951
712
  break;
952
- case 18:
953
- _context4.prev = 18;
954
- _context4.t0 = _context4["catch"](3);
713
+ case 5:
714
+ _context4.p = 5;
955
715
  dispatch({
956
716
  type: SET_SEND_EMAIL_VERIFICATION_STATUS,
957
717
  payload: {
@@ -963,12 +723,11 @@ function _sendEmailVerificationAction() {
963
723
  type: SET_SEND_EMAIL_VERIFICATION_IS_LOADING,
964
724
  payload: false
965
725
  });
966
- return _context4.abrupt("return", false);
967
- case 23:
968
- case "end":
969
- return _context4.stop();
726
+ return _context4.a(2, false);
727
+ case 6:
728
+ return _context4.a(2);
970
729
  }
971
- }, _callee4, null, [[3, 18]]);
730
+ }, _callee4, null, [[1, 5]]);
972
731
  }));
973
732
  return _sendEmailVerificationAction.apply(this, arguments);
974
733
  }
@@ -976,43 +735,40 @@ function checkTokenAction(_x5) {
976
735
  return _checkTokenAction.apply(this, arguments);
977
736
  }
978
737
  function _checkTokenAction() {
979
- _checkTokenAction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref6) {
980
- var dispatch, domainName, token, refreshAccessTokenFetch;
981
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
982
- 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) {
983
742
  case 0:
984
743
  dispatch = _ref6.dispatch, domainName = _ref6.domainName, token = _ref6.token;
985
- _context5.prev = 1;
986
- _context5.next = 4;
744
+ _context5.p = 1;
745
+ _context5.n = 2;
987
746
  return refreshAccessTokenAPI(domainName, token);
988
- case 4:
989
- refreshAccessTokenFetch = _context5.sent;
747
+ case 2:
748
+ refreshAccessTokenFetch = _context5.v;
990
749
  if (!(refreshAccessTokenFetch.response.status === 200)) {
991
- _context5.next = 10;
750
+ _context5.n = 3;
992
751
  break;
993
752
  }
994
753
  if (refreshAccessTokenFetch.data.accessToken) {
995
754
  localStorage.setItem(TOKEN_LS, refreshAccessTokenFetch.data.accessToken);
996
755
  }
997
- return _context5.abrupt("return");
998
- case 10:
999
- window.location.replace(getClientBasePath({
1000
- domainName: domainName
1001
- }) + "/" + domainName + "/" + routes.signin);
1002
- return _context5.abrupt("return", resetUser(dispatch));
1003
- case 12:
1004
- _context5.next = 18;
756
+ return _context5.a(2);
757
+ case 3:
758
+ window.location.replace(getClientBasePath() + "/" + domainName + "/" + routes.signin);
759
+ return _context5.a(2, resetUser(dispatch));
760
+ case 4:
761
+ _context5.n = 6;
1005
762
  break;
1006
- case 14:
1007
- _context5.prev = 14;
1008
- _context5.t0 = _context5["catch"](1);
763
+ case 5:
764
+ _context5.p = 5;
765
+ _t5 = _context5.v;
1009
766
  resetUser(dispatch);
1010
- throw _context5.t0;
1011
- case 18:
1012
- case "end":
1013
- return _context5.stop();
767
+ throw _t5;
768
+ case 6:
769
+ return _context5.a(2);
1014
770
  }
1015
- }, _callee5, null, [[1, 14]]);
771
+ }, _callee5, null, [[1, 5]]);
1016
772
  }));
1017
773
  return _checkTokenAction.apply(this, arguments);
1018
774
  }
@@ -1022,45 +778,44 @@ function getAccessTokenAction(_x6) {
1022
778
  ///////////////////////////////////////////
1023
779
  //////////////////////////////////////////
1024
780
  function _getAccessTokenAction() {
1025
- _getAccessTokenAction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref7) {
1026
- var dispatch, domainName, token_ls, refreshAccessTokenFetch, _refreshAccessTokenFe;
1027
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1028
- 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) {
1029
785
  case 0:
1030
786
  dispatch = _ref7.dispatch, domainName = _ref7.domainName;
1031
787
  token_ls = localStorage.getItem(TOKEN_LS);
1032
788
  if (token_ls) {
1033
- _context6.next = 4;
789
+ _context6.n = 1;
1034
790
  break;
1035
791
  }
1036
- return _context6.abrupt("return");
1037
- case 4:
1038
- _context6.prev = 4;
1039
- _context6.next = 7;
792
+ return _context6.a(2);
793
+ case 1:
794
+ _context6.p = 1;
795
+ _context6.n = 2;
1040
796
  return refreshAccessTokenAPI(domainName, token_ls);
1041
- case 7:
1042
- refreshAccessTokenFetch = _context6.sent;
797
+ case 2:
798
+ refreshAccessTokenFetch = _context6.v;
1043
799
  if (!(refreshAccessTokenFetch.response.status === 200)) {
1044
- _context6.next = 12;
800
+ _context6.n = 3;
1045
801
  break;
1046
802
  }
1047
- return _context6.abrupt("return", (_refreshAccessTokenFe = refreshAccessTokenFetch.data.accessToken) != null ? _refreshAccessTokenFe : token_ls);
1048
- case 12:
803
+ return _context6.a(2, (_refreshAccessTokenFe = refreshAccessTokenFetch.data.accessToken) != null ? _refreshAccessTokenFe : token_ls);
804
+ case 3:
1049
805
  resetUser(dispatch);
1050
- return _context6.abrupt("return", 'token-not-found');
1051
- case 14:
1052
- _context6.next = 20;
806
+ return _context6.a(2, 'token-not-found');
807
+ case 4:
808
+ _context6.n = 6;
1053
809
  break;
1054
- case 16:
1055
- _context6.prev = 16;
1056
- _context6.t0 = _context6["catch"](4);
810
+ case 5:
811
+ _context6.p = 5;
812
+ _t6 = _context6.v;
1057
813
  resetUser(dispatch);
1058
- throw _context6.t0;
1059
- case 20:
1060
- case "end":
1061
- return _context6.stop();
814
+ throw _t6;
815
+ case 6:
816
+ return _context6.a(2);
1062
817
  }
1063
- }, _callee6, null, [[4, 16]]);
818
+ }, _callee6, null, [[1, 5]]);
1064
819
  }));
1065
820
  return _getAccessTokenAction.apply(this, arguments);
1066
821
  }
@@ -1083,37 +838,33 @@ var DauthProvider = function DauthProvider(props) {
1083
838
  var _useReducer = React.useReducer(userReducer, initialDauthState),
1084
839
  dauthState = _useReducer[0],
1085
840
  dispatch = _useReducer[1];
1086
- var isValidTsk = React.useCallback( /*#__PURE__*/function () {
1087
- 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) {
1088
843
  var verifyToken;
1089
- return _regeneratorRuntime().wrap(function _callee$(_context) {
1090
- while (1) switch (_context.prev = _context.next) {
844
+ return _regenerator().w(function (_context) {
845
+ while (1) switch (_context.p = _context.n) {
1091
846
  case 0:
1092
- _context.prev = 0;
1093
- _context.next = 3;
847
+ _context.p = 0;
848
+ _context.n = 1;
1094
849
  return verifyTokenAPI({
1095
850
  domainName: domainName,
1096
851
  token: token,
1097
852
  tsk: tsk
1098
853
  });
1099
- case 3:
1100
- verifyToken = _context.sent;
854
+ case 1:
855
+ verifyToken = _context.v;
1101
856
  if (!(verifyToken.response.status !== 200)) {
1102
- _context.next = 6;
857
+ _context.n = 2;
1103
858
  break;
1104
859
  }
1105
- return _context.abrupt("return", false);
1106
- case 6:
1107
- return _context.abrupt("return", true);
1108
- case 9:
1109
- _context.prev = 9;
1110
- _context.t0 = _context["catch"](0);
1111
- return _context.abrupt("return", false);
1112
- case 12:
1113
- case "end":
1114
- 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);
1115
866
  }
1116
- }, _callee, null, [[0, 9]]);
867
+ }, _callee, null, [[0, 3]]);
1117
868
  }));
1118
869
  return function (_x) {
1119
870
  return _ref.apply(this, arguments);
@@ -1122,39 +873,38 @@ var DauthProvider = function DauthProvider(props) {
1122
873
  // Check token periodically
1123
874
  React.useEffect(function () {
1124
875
  if (!dauthState.isAuthenticated) return;
1125
- var interval = setInterval( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
876
+ var interval = setInterval(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
1126
877
  var token_ls, isValid;
1127
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1128
- while (1) switch (_context2.prev = _context2.next) {
878
+ return _regenerator().w(function (_context2) {
879
+ while (1) switch (_context2.n) {
1129
880
  case 0:
1130
881
  token_ls = localStorage.getItem(TOKEN_LS);
1131
882
  if (token_ls) {
1132
- _context2.next = 3;
883
+ _context2.n = 1;
1133
884
  break;
1134
885
  }
1135
- return _context2.abrupt("return");
1136
- case 3:
1137
- _context2.next = 5;
886
+ return _context2.a(2);
887
+ case 1:
888
+ _context2.n = 2;
1138
889
  return isValidTsk(token_ls);
1139
- case 5:
1140
- isValid = _context2.sent;
890
+ case 2:
891
+ isValid = _context2.v;
1141
892
  if (!isValid) {
1142
- _context2.next = 10;
893
+ _context2.n = 3;
1143
894
  break;
1144
895
  }
1145
- return _context2.abrupt("return", checkTokenAction({
896
+ return _context2.a(2, checkTokenAction({
1146
897
  dispatch: dispatch,
1147
898
  domainName: domainName,
1148
899
  token: token_ls
1149
900
  }));
1150
- case 10:
901
+ case 3:
1151
902
  setLogoutAction({
1152
903
  dispatch: dispatch
1153
904
  });
1154
905
  throw new Error('Ask value in DauthProvider is not valid');
1155
- case 12:
1156
- case "end":
1157
- return _context2.stop();
906
+ case 4:
907
+ return _context2.a(2);
1158
908
  }
1159
909
  }, _callee2);
1160
910
  })), 1000 * 60 * 5);
@@ -1164,130 +914,123 @@ var DauthProvider = function DauthProvider(props) {
1164
914
  }, [dauthState.isAuthenticated, isValidTsk]);
1165
915
  // Catch login redirect
1166
916
  React.useEffect(function () {
1167
- _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
917
+ _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
1168
918
  var queryString, urlParams, token_url, isValid;
1169
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1170
- while (1) switch (_context3.prev = _context3.next) {
919
+ return _regenerator().w(function (_context3) {
920
+ while (1) switch (_context3.n) {
1171
921
  case 0:
1172
922
  queryString = window.location.search;
1173
923
  if (queryString) {
1174
- _context3.next = 3;
924
+ _context3.n = 1;
1175
925
  break;
1176
926
  }
1177
- return _context3.abrupt("return");
1178
- case 3:
927
+ return _context3.a(2);
928
+ case 1:
1179
929
  urlParams = new URLSearchParams(queryString);
1180
930
  token_url = urlParams.get(TOKEN_LS);
1181
931
  if (!(token_url && !dauthState.isAuthenticated)) {
1182
- _context3.next = 15;
932
+ _context3.n = 4;
1183
933
  break;
1184
934
  }
1185
- _context3.next = 8;
935
+ _context3.n = 2;
1186
936
  return isValidTsk(token_url);
1187
- case 8:
1188
- isValid = _context3.sent;
937
+ case 2:
938
+ isValid = _context3.v;
1189
939
  if (!isValid) {
1190
- _context3.next = 13;
940
+ _context3.n = 3;
1191
941
  break;
1192
942
  }
1193
- return _context3.abrupt("return", setDauthStateAction({
943
+ return _context3.a(2, setDauthStateAction({
1194
944
  dispatch: dispatch,
1195
945
  token: token_url,
1196
946
  domainName: domainName
1197
947
  }));
1198
- case 13:
948
+ case 3:
1199
949
  setLogoutAction({
1200
950
  dispatch: dispatch
1201
951
  });
1202
952
  throw new Error('Ask value in DauthProvider is not valid');
1203
- case 15:
1204
- case "end":
1205
- return _context3.stop();
953
+ case 4:
954
+ return _context3.a(2);
1206
955
  }
1207
956
  }, _callee3);
1208
957
  }))();
1209
958
  }, []);
1210
959
  // Auto Login
1211
960
  React.useEffect(function () {
1212
- _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
961
+ _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
1213
962
  var token_ls, isValid;
1214
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1215
- while (1) switch (_context4.prev = _context4.next) {
963
+ return _regenerator().w(function (_context4) {
964
+ while (1) switch (_context4.n) {
1216
965
  case 0:
1217
966
  token_ls = localStorage.getItem(TOKEN_LS);
1218
967
  if (!(token_ls && !dauthState.isAuthenticated)) {
1219
- _context4.next = 13;
968
+ _context4.n = 4;
1220
969
  break;
1221
970
  }
1222
- _context4.next = 4;
971
+ _context4.n = 1;
1223
972
  return isValidTsk(token_ls);
1224
- case 4:
1225
- isValid = _context4.sent;
973
+ case 1:
974
+ isValid = _context4.v;
1226
975
  if (!isValid) {
1227
- _context4.next = 9;
976
+ _context4.n = 2;
1228
977
  break;
1229
978
  }
1230
- return _context4.abrupt("return", setAutoLoginAction({
979
+ return _context4.a(2, setAutoLoginAction({
1231
980
  dispatch: dispatch,
1232
981
  token_ls: token_ls,
1233
982
  domainName: domainName
1234
983
  }));
1235
- case 9:
984
+ case 2:
1236
985
  setLogoutAction({
1237
986
  dispatch: dispatch
1238
987
  });
1239
988
  throw new Error('Ask value in DauthProvider is not valid');
1240
- case 11:
1241
- _context4.next = 14;
989
+ case 3:
990
+ _context4.n = 5;
1242
991
  break;
1243
- case 13:
1244
- return _context4.abrupt("return", dispatch({
992
+ case 4:
993
+ return _context4.a(2, dispatch({
1245
994
  type: SET_IS_LOADING,
1246
995
  payload: {
1247
996
  isLoading: false
1248
997
  }
1249
998
  }));
1250
- case 14:
1251
- case "end":
1252
- return _context4.stop();
999
+ case 5:
1000
+ return _context4.a(2);
1253
1001
  }
1254
1002
  }, _callee4);
1255
1003
  }))();
1256
1004
  }, []);
1257
1005
  var loginWithRedirect = React.useCallback(function () {
1258
- return window.location.replace(getClientBasePath({
1259
- domainName: domainName
1260
- }) + "/" + domainName + "/" + routes.signin);
1006
+ return window.location.replace(getClientBasePath() + "/" + domainName + "/" + routes.signin);
1261
1007
  }, [domainName]);
1262
1008
  var logout = React.useCallback(function () {
1263
1009
  return setLogoutAction({
1264
1010
  dispatch: dispatch
1265
1011
  });
1266
1012
  }, []);
1267
- var getAccessToken = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
1013
+ var getAccessToken = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
1268
1014
  var token;
1269
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1270
- while (1) switch (_context5.prev = _context5.next) {
1015
+ return _regenerator().w(function (_context5) {
1016
+ while (1) switch (_context5.n) {
1271
1017
  case 0:
1272
- _context5.next = 2;
1018
+ _context5.n = 1;
1273
1019
  return getAccessTokenAction({
1274
1020
  dispatch: dispatch,
1275
1021
  domainName: domainName
1276
1022
  });
1277
- case 2:
1278
- token = _context5.sent;
1279
- return _context5.abrupt("return", token);
1280
- case 4:
1281
- case "end":
1282
- return _context5.stop();
1023
+ case 1:
1024
+ token = _context5.v;
1025
+ return _context5.a(2, token);
1283
1026
  }
1284
1027
  }, _callee5);
1285
1028
  })), [domainName]);
1286
- var updateUser = React.useCallback( /*#__PURE__*/function () {
1287
- 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) {
1288
1031
  var name, lastname, nickname, telPrefix, telSuffix, language, avatar, token_ls, user;
1289
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1290
- while (1) switch (_context6.prev = _context6.next) {
1032
+ return _regenerator().w(function (_context6) {
1033
+ while (1) switch (_context6.n) {
1291
1034
  case 0:
1292
1035
  name = _ref6.name, lastname = _ref6.lastname, nickname = _ref6.nickname, telPrefix = _ref6.telPrefix, telSuffix = _ref6.telSuffix, language = _ref6.language, avatar = _ref6.avatar;
1293
1036
  token_ls = localStorage.getItem(TOKEN_LS);
@@ -1300,18 +1043,15 @@ var DauthProvider = function DauthProvider(props) {
1300
1043
  language: language,
1301
1044
  avatar: avatar
1302
1045
  };
1303
- _context6.next = 5;
1046
+ _context6.n = 1;
1304
1047
  return setUpdateUserAction({
1305
1048
  dispatch: dispatch,
1306
1049
  domainName: domainName,
1307
1050
  user: user,
1308
1051
  token: token_ls
1309
1052
  });
1310
- case 5:
1311
- return _context6.abrupt("return", _context6.sent);
1312
- case 6:
1313
- case "end":
1314
- return _context6.stop();
1053
+ case 1:
1054
+ return _context6.a(2, _context6.v);
1315
1055
  }
1316
1056
  }, _callee6);
1317
1057
  }));
@@ -1322,33 +1062,28 @@ var DauthProvider = function DauthProvider(props) {
1322
1062
  var updateUserWithRedirect = React.useCallback(function () {
1323
1063
  var token_ls = localStorage.getItem(TOKEN_LS);
1324
1064
  if (!token_ls) return;
1325
- return window.location.replace(getClientBasePath({
1326
- domainName: domainName
1327
- }) + "/" + domainName + "/" + routes.updateUser + "/" + token_ls);
1065
+ return window.location.replace(getClientBasePath() + "/" + domainName + "/" + routes.updateUser + "/" + token_ls);
1328
1066
  }, [domainName]);
1329
- var sendEmailVerification = React.useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
1067
+ var sendEmailVerification = React.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee7() {
1330
1068
  var token_ls;
1331
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1332
- while (1) switch (_context7.prev = _context7.next) {
1069
+ return _regenerator().w(function (_context7) {
1070
+ while (1) switch (_context7.n) {
1333
1071
  case 0:
1334
1072
  token_ls = localStorage.getItem(TOKEN_LS);
1335
1073
  if (token_ls) {
1336
- _context7.next = 3;
1074
+ _context7.n = 1;
1337
1075
  break;
1338
1076
  }
1339
- return _context7.abrupt("return", false);
1340
- case 3:
1341
- _context7.next = 5;
1077
+ return _context7.a(2, false);
1078
+ case 1:
1079
+ _context7.n = 2;
1342
1080
  return sendEmailVerificationAction({
1343
1081
  dispatch: dispatch,
1344
1082
  domainName: domainName,
1345
1083
  token: token_ls
1346
1084
  });
1347
- case 5:
1348
- return _context7.abrupt("return", _context7.sent);
1349
- case 6:
1350
- case "end":
1351
- return _context7.stop();
1085
+ case 2:
1086
+ return _context7.a(2, _context7.v);
1352
1087
  }
1353
1088
  }, _callee7);
1354
1089
  })), [domainName]);