@edx/frontend-platform 3.6.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/analytics/MockAnalyticsService.js +31 -19
- package/analytics/MockAnalyticsService.js.map +1 -1
- package/analytics/SegmentAnalyticsService.js +53 -57
- package/analytics/SegmentAnalyticsService.js.map +1 -1
- package/analytics/index.js.map +1 -1
- package/analytics/interface.js +9 -9
- package/analytics/interface.js.map +1 -1
- package/auth/AxiosCsrfTokenService.js +36 -58
- package/auth/AxiosCsrfTokenService.js.map +1 -1
- package/auth/AxiosJwtAuthService.js +105 -150
- package/auth/AxiosJwtAuthService.js.map +1 -1
- package/auth/AxiosJwtTokenService.js +101 -148
- package/auth/AxiosJwtTokenService.js.map +1 -1
- package/auth/LocalForageCache.js +89 -108
- package/auth/LocalForageCache.js.map +1 -1
- package/auth/MockAuthService.js +114 -43
- package/auth/MockAuthService.js.map +1 -1
- package/auth/index.js.map +1 -1
- package/auth/interceptors/createCsrfTokenProviderInterceptor.js +35 -50
- package/auth/interceptors/createCsrfTokenProviderInterceptor.js.map +1 -1
- package/auth/interceptors/createJwtTokenProviderInterceptor.js +33 -47
- package/auth/interceptors/createJwtTokenProviderInterceptor.js.map +1 -1
- package/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js +15 -27
- package/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js.map +1 -1
- package/auth/interceptors/createRetryInterceptor.js +75 -105
- package/auth/interceptors/createRetryInterceptor.js.map +1 -1
- package/auth/interface.js +41 -58
- package/auth/interface.js.map +1 -1
- package/auth/utils.js +22 -40
- package/auth/utils.js.map +1 -1
- package/config.js +6 -7
- package/config.js.map +1 -1
- package/constants.js +8 -8
- package/constants.js.map +1 -1
- package/i18n/countries.js +9 -15
- package/i18n/countries.js.map +1 -1
- package/i18n/index.js +1 -0
- package/i18n/index.js.map +1 -1
- package/i18n/injectIntlWithShim.js +4 -28
- package/i18n/injectIntlWithShim.js.map +1 -1
- package/i18n/languages.js +11 -17
- package/i18n/languages.js.map +1 -1
- package/i18n/lib.js +64 -56
- package/i18n/lib.js.map +1 -1
- package/i18n/scripts/transifex-utils.js +5 -20
- package/i18n/scripts/transifex-utils.js.map +1 -1
- package/index.js.map +1 -1
- package/initialize.js +176 -228
- package/initialize.js.map +1 -1
- package/logging/MockLoggingService.js +15 -9
- package/logging/MockLoggingService.js.map +1 -1
- package/logging/NewRelicLoggingService.js +9 -33
- package/logging/NewRelicLoggingService.js.map +1 -1
- package/logging/index.js.map +1 -1
- package/logging/interface.js +7 -6
- package/logging/interface.js.map +1 -1
- package/package.json +4 -4
- package/pubSub.js +4 -3
- package/pubSub.js.map +1 -1
- package/react/AppContext.js +1 -1
- package/react/AppContext.js.map +1 -1
- package/react/AppProvider.js +13 -23
- package/react/AppProvider.js.map +1 -1
- package/react/AuthenticatedPageRoute.js +5 -13
- package/react/AuthenticatedPageRoute.js.map +1 -1
- package/react/ErrorBoundary.js +4 -21
- package/react/ErrorBoundary.js.map +1 -1
- package/react/ErrorPage.js +7 -17
- package/react/ErrorPage.js.map +1 -1
- package/react/LoginRedirect.js +1 -1
- package/react/LoginRedirect.js.map +1 -1
- package/react/OptionalReduxProvider.js +2 -4
- package/react/OptionalReduxProvider.js.map +1 -1
- package/react/PageRoute.js +3 -3
- package/react/PageRoute.js.map +1 -1
- package/react/hooks.js +2 -6
- package/react/hooks.js.map +1 -1
- package/react/index.js +1 -0
- package/react/index.js.map +1 -1
- package/testing/index.js +1 -0
- package/testing/index.js.map +1 -1
- package/testing/initializeMockApp.js +11 -11
- package/testing/initializeMockApp.js.map +1 -1
- package/testing/mockMessages.js.map +1 -1
- package/utils.js +15 -24
- package/utils.js.map +1 -1
package/initialize.js
CHANGED
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
|
|
3
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
|
|
7
|
-
function
|
|
8
|
-
|
|
9
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
10
|
-
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
11
8
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
12
|
-
|
|
13
9
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
14
|
-
|
|
15
10
|
/**
|
|
16
11
|
* #### Import members from **@edx/frontend-platform**
|
|
17
12
|
*
|
|
@@ -58,9 +53,10 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
58
53
|
```
|
|
59
54
|
* @module Initialization
|
|
60
55
|
*/
|
|
61
|
-
import { createBrowserHistory, createMemoryHistory } from 'history';
|
|
62
|
-
import { publish } from './pubSub'; // eslint-disable-next-line import/no-cycle
|
|
63
56
|
|
|
57
|
+
import { createBrowserHistory, createMemoryHistory } from 'history';
|
|
58
|
+
import { publish } from './pubSub';
|
|
59
|
+
// eslint-disable-next-line import/no-cycle
|
|
64
60
|
import { getConfig, mergeConfig } from './config';
|
|
65
61
|
import { configure as configureLogging, getLoggingService, NewRelicLoggingService, logError } from './logging';
|
|
66
62
|
import { configure as configureAnalytics, SegmentAnalyticsService, identifyAnonymousUser, identifyAuthenticatedUser } from './analytics';
|
|
@@ -68,6 +64,7 @@ import { getAuthenticatedHttpClient, configure as configureAuth, ensureAuthentic
|
|
|
68
64
|
import { configure as configureI18n } from './i18n';
|
|
69
65
|
import { APP_PUBSUB_INITIALIZED, APP_CONFIG_INITIALIZED, APP_AUTH_INITIALIZED, APP_I18N_INITIALIZED, APP_LOGGING_INITIALIZED, APP_ANALYTICS_INITIALIZED, APP_READY, APP_INIT_ERROR } from './constants';
|
|
70
66
|
import configureCache from './auth/LocalForageCache';
|
|
67
|
+
|
|
71
68
|
/**
|
|
72
69
|
* A browser history or memory history object created by the [history](https://github.com/ReactTraining/history)
|
|
73
70
|
* package. Applications are encouraged to use this history object, rather than creating their own,
|
|
@@ -75,10 +72,10 @@ import configureCache from './auth/LocalForageCache';
|
|
|
75
72
|
* in environments where browser history may be inaccessible due to `window` being undefined, this
|
|
76
73
|
* falls back to memory history.
|
|
77
74
|
*/
|
|
78
|
-
|
|
79
75
|
export var history = typeof window !== 'undefined' ? createBrowserHistory({
|
|
80
76
|
basename: getConfig().PUBLIC_PATH
|
|
81
77
|
}) : createMemoryHistory();
|
|
78
|
+
|
|
82
79
|
/**
|
|
83
80
|
* The default handler for the initialization lifecycle's `initError` phase. Logs the error to the
|
|
84
81
|
* LoggingService using `logError`
|
|
@@ -86,10 +83,10 @@ export var history = typeof window !== 'undefined' ? createBrowserHistory({
|
|
|
86
83
|
* @see {@link module:frontend-platform/logging~logError}
|
|
87
84
|
* @param {*} error
|
|
88
85
|
*/
|
|
89
|
-
|
|
90
86
|
export function initError(_x) {
|
|
91
87
|
return _initError.apply(this, arguments);
|
|
92
88
|
}
|
|
89
|
+
|
|
93
90
|
/**
|
|
94
91
|
* The default handler for the initialization lifecycle's `auth` phase.
|
|
95
92
|
*
|
|
@@ -103,25 +100,20 @@ export function initError(_x) {
|
|
|
103
100
|
* authenticated.
|
|
104
101
|
* @param {boolean} hydrateUser Whether or not we should fetch additional user account data.
|
|
105
102
|
*/
|
|
106
|
-
|
|
107
103
|
function _initError() {
|
|
108
104
|
_initError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(error) {
|
|
109
105
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
110
|
-
while (1) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
case "end":
|
|
117
|
-
return _context2.stop();
|
|
118
|
-
}
|
|
106
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
107
|
+
case 0:
|
|
108
|
+
logError(error);
|
|
109
|
+
case 1:
|
|
110
|
+
case "end":
|
|
111
|
+
return _context2.stop();
|
|
119
112
|
}
|
|
120
113
|
}, _callee2);
|
|
121
114
|
}));
|
|
122
115
|
return _initError.apply(this, arguments);
|
|
123
116
|
}
|
|
124
|
-
|
|
125
117
|
export function auth(_x2, _x3) {
|
|
126
118
|
return _auth.apply(this, arguments);
|
|
127
119
|
}
|
|
@@ -130,50 +122,42 @@ export function auth(_x2, _x3) {
|
|
|
130
122
|
* This method allows runtime configuration.
|
|
131
123
|
* Set a basic configuration when an error happen and allow initError and display the ErrorPage.
|
|
132
124
|
*/
|
|
133
|
-
|
|
134
125
|
function _auth() {
|
|
135
126
|
_auth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(requireUser, hydrateUser) {
|
|
136
127
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
137
|
-
while (1) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
_context3.next = 5;
|
|
142
|
-
break;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
_context3.next = 3;
|
|
146
|
-
return ensureAuthenticatedUser(global.location.href);
|
|
147
|
-
|
|
148
|
-
case 3:
|
|
149
|
-
_context3.next = 7;
|
|
128
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
129
|
+
case 0:
|
|
130
|
+
if (!requireUser) {
|
|
131
|
+
_context3.next = 5;
|
|
150
132
|
break;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
133
|
+
}
|
|
134
|
+
_context3.next = 3;
|
|
135
|
+
return ensureAuthenticatedUser(global.location.href);
|
|
136
|
+
case 3:
|
|
137
|
+
_context3.next = 7;
|
|
138
|
+
break;
|
|
139
|
+
case 5:
|
|
140
|
+
_context3.next = 7;
|
|
141
|
+
return fetchAuthenticatedUser();
|
|
142
|
+
case 7:
|
|
143
|
+
if (hydrateUser && getAuthenticatedUser() !== null) {
|
|
144
|
+
// We intentionally do not await the promise returned by hydrateAuthenticatedUser. All the
|
|
145
|
+
// critical data is returned as part of fetch/ensureAuthenticatedUser above, and anything else
|
|
146
|
+
// is a nice-to-have for application code.
|
|
147
|
+
hydrateAuthenticatedUser();
|
|
148
|
+
}
|
|
149
|
+
case 8:
|
|
150
|
+
case "end":
|
|
151
|
+
return _context3.stop();
|
|
168
152
|
}
|
|
169
153
|
}, _callee3);
|
|
170
154
|
}));
|
|
171
155
|
return _auth.apply(this, arguments);
|
|
172
156
|
}
|
|
173
|
-
|
|
174
157
|
export function runtimeConfig() {
|
|
175
158
|
return _runtimeConfig.apply(this, arguments);
|
|
176
159
|
}
|
|
160
|
+
|
|
177
161
|
/**
|
|
178
162
|
* The default handler for the initialization lifecycle's `analytics` phase.
|
|
179
163
|
*
|
|
@@ -182,119 +166,95 @@ export function runtimeConfig() {
|
|
|
182
166
|
* initialization sequence so that analytics is ready once the application's UI code starts to load.
|
|
183
167
|
*
|
|
184
168
|
*/
|
|
185
|
-
|
|
186
169
|
function _runtimeConfig() {
|
|
187
170
|
_runtimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
188
171
|
var _getConfig, MFE_CONFIG_API_URL, APP_ID, apiConfig, apiService, params, url, _yield$apiService$get, data;
|
|
189
|
-
|
|
190
172
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
191
|
-
while (1) {
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
if (!MFE_CONFIG_API_URL) {
|
|
198
|
-
_context4.next = 15;
|
|
199
|
-
break;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
apiConfig = {
|
|
203
|
-
headers: {
|
|
204
|
-
accept: 'application/json'
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
_context4.next = 6;
|
|
208
|
-
return configureCache();
|
|
209
|
-
|
|
210
|
-
case 6:
|
|
211
|
-
apiService = _context4.sent;
|
|
212
|
-
params = new URLSearchParams();
|
|
213
|
-
params.append('mfe', APP_ID);
|
|
214
|
-
url = "".concat(MFE_CONFIG_API_URL, "?").concat(params.toString());
|
|
215
|
-
_context4.next = 12;
|
|
216
|
-
return apiService.get(url, apiConfig);
|
|
217
|
-
|
|
218
|
-
case 12:
|
|
219
|
-
_yield$apiService$get = _context4.sent;
|
|
220
|
-
data = _yield$apiService$get.data;
|
|
221
|
-
mergeConfig(data);
|
|
222
|
-
|
|
223
|
-
case 15:
|
|
224
|
-
_context4.next = 20;
|
|
173
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
174
|
+
case 0:
|
|
175
|
+
_context4.prev = 0;
|
|
176
|
+
_getConfig = getConfig(), MFE_CONFIG_API_URL = _getConfig.MFE_CONFIG_API_URL, APP_ID = _getConfig.APP_ID;
|
|
177
|
+
if (!MFE_CONFIG_API_URL) {
|
|
178
|
+
_context4.next = 15;
|
|
225
179
|
break;
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
180
|
+
}
|
|
181
|
+
apiConfig = {
|
|
182
|
+
headers: {
|
|
183
|
+
accept: 'application/json'
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
_context4.next = 6;
|
|
187
|
+
return configureCache();
|
|
188
|
+
case 6:
|
|
189
|
+
apiService = _context4.sent;
|
|
190
|
+
params = new URLSearchParams();
|
|
191
|
+
params.append('mfe', APP_ID);
|
|
192
|
+
url = "".concat(MFE_CONFIG_API_URL, "?").concat(params.toString());
|
|
193
|
+
_context4.next = 12;
|
|
194
|
+
return apiService.get(url, apiConfig);
|
|
195
|
+
case 12:
|
|
196
|
+
_yield$apiService$get = _context4.sent;
|
|
197
|
+
data = _yield$apiService$get.data;
|
|
198
|
+
mergeConfig(data);
|
|
199
|
+
case 15:
|
|
200
|
+
_context4.next = 20;
|
|
201
|
+
break;
|
|
202
|
+
case 17:
|
|
203
|
+
_context4.prev = 17;
|
|
204
|
+
_context4.t0 = _context4["catch"](0);
|
|
205
|
+
// eslint-disable-next-line no-console
|
|
206
|
+
console.error('Error with config API', _context4.t0.message);
|
|
207
|
+
case 20:
|
|
208
|
+
case "end":
|
|
209
|
+
return _context4.stop();
|
|
237
210
|
}
|
|
238
211
|
}, _callee4, null, [[0, 17]]);
|
|
239
212
|
}));
|
|
240
213
|
return _runtimeConfig.apply(this, arguments);
|
|
241
214
|
}
|
|
242
|
-
|
|
243
215
|
export function analytics() {
|
|
244
216
|
return _analytics.apply(this, arguments);
|
|
245
217
|
}
|
|
246
|
-
|
|
247
218
|
function _analytics() {
|
|
248
219
|
_analytics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
249
220
|
var authenticatedUser;
|
|
250
221
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
251
|
-
while (1) {
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
if (!(authenticatedUser && authenticatedUser.userId)) {
|
|
257
|
-
_context5.next = 5;
|
|
258
|
-
break;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
identifyAuthenticatedUser(authenticatedUser.userId);
|
|
262
|
-
_context5.next = 7;
|
|
222
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
223
|
+
case 0:
|
|
224
|
+
authenticatedUser = getAuthenticatedUser();
|
|
225
|
+
if (!(authenticatedUser && authenticatedUser.userId)) {
|
|
226
|
+
_context5.next = 5;
|
|
263
227
|
break;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
228
|
+
}
|
|
229
|
+
identifyAuthenticatedUser(authenticatedUser.userId);
|
|
230
|
+
_context5.next = 7;
|
|
231
|
+
break;
|
|
232
|
+
case 5:
|
|
233
|
+
_context5.next = 7;
|
|
234
|
+
return identifyAnonymousUser();
|
|
235
|
+
case 7:
|
|
236
|
+
case "end":
|
|
237
|
+
return _context5.stop();
|
|
273
238
|
}
|
|
274
239
|
}, _callee5);
|
|
275
240
|
}));
|
|
276
241
|
return _analytics.apply(this, arguments);
|
|
277
242
|
}
|
|
278
|
-
|
|
279
243
|
function applyOverrideHandlers(overrides) {
|
|
280
244
|
var noOp = /*#__PURE__*/function () {
|
|
281
245
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
282
246
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
283
|
-
while (1) {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
return _context.stop();
|
|
288
|
-
}
|
|
247
|
+
while (1) switch (_context.prev = _context.next) {
|
|
248
|
+
case 0:
|
|
249
|
+
case "end":
|
|
250
|
+
return _context.stop();
|
|
289
251
|
}
|
|
290
252
|
}, _callee);
|
|
291
253
|
}));
|
|
292
|
-
|
|
293
254
|
return function noOp() {
|
|
294
255
|
return _ref.apply(this, arguments);
|
|
295
256
|
};
|
|
296
257
|
}();
|
|
297
|
-
|
|
298
258
|
return _objectSpread({
|
|
299
259
|
pubSub: noOp,
|
|
300
260
|
config: noOp,
|
|
@@ -306,6 +266,7 @@ function applyOverrideHandlers(overrides) {
|
|
|
306
266
|
initError: initError
|
|
307
267
|
}, overrides);
|
|
308
268
|
}
|
|
269
|
+
|
|
309
270
|
/**
|
|
310
271
|
* Invokes the application initialization sequence.
|
|
311
272
|
*
|
|
@@ -352,108 +313,95 @@ function applyOverrideHandlers(overrides) {
|
|
|
352
313
|
* default behavior of any part of the startup sequence. It can also be used to add additional
|
|
353
314
|
* initialization behavior before or after the rest of the sequence.
|
|
354
315
|
*/
|
|
355
|
-
|
|
356
|
-
|
|
357
316
|
export function initialize(_x4) {
|
|
358
317
|
return _initialize.apply(this, arguments);
|
|
359
318
|
}
|
|
360
|
-
|
|
361
319
|
function _initialize() {
|
|
362
320
|
_initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref2) {
|
|
363
321
|
var _ref2$loggingService, loggingService, _ref2$analyticsServic, analyticsService, _ref2$authService, authService, _ref2$authMiddleware, authMiddleware, _ref2$requireAuthenti, requireUser, _ref2$hydrateAuthenti, hydrateUser, messages, _ref2$handlers, overrideHandlers, handlers;
|
|
364
|
-
|
|
365
322
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
366
|
-
while (1) {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
323
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
324
|
+
case 0:
|
|
325
|
+
_ref2$loggingService = _ref2.loggingService, loggingService = _ref2$loggingService === void 0 ? NewRelicLoggingService : _ref2$loggingService, _ref2$analyticsServic = _ref2.analyticsService, analyticsService = _ref2$analyticsServic === void 0 ? SegmentAnalyticsService : _ref2$analyticsServic, _ref2$authService = _ref2.authService, authService = _ref2$authService === void 0 ? AxiosJwtAuthService : _ref2$authService, _ref2$authMiddleware = _ref2.authMiddleware, authMiddleware = _ref2$authMiddleware === void 0 ? [] : _ref2$authMiddleware, _ref2$requireAuthenti = _ref2.requireAuthenticatedUser, requireUser = _ref2$requireAuthenti === void 0 ? false : _ref2$requireAuthenti, _ref2$hydrateAuthenti = _ref2.hydrateAuthenticatedUser, hydrateUser = _ref2$hydrateAuthenti === void 0 ? false : _ref2$hydrateAuthenti, messages = _ref2.messages, _ref2$handlers = _ref2.handlers, overrideHandlers = _ref2$handlers === void 0 ? {} : _ref2$handlers;
|
|
326
|
+
handlers = applyOverrideHandlers(overrideHandlers);
|
|
327
|
+
_context6.prev = 2;
|
|
328
|
+
_context6.next = 5;
|
|
329
|
+
return handlers.pubSub();
|
|
330
|
+
case 5:
|
|
331
|
+
publish(APP_PUBSUB_INITIALIZED);
|
|
332
|
+
|
|
333
|
+
// Configuration
|
|
334
|
+
_context6.next = 8;
|
|
335
|
+
return handlers.config();
|
|
336
|
+
case 8:
|
|
337
|
+
_context6.next = 10;
|
|
338
|
+
return runtimeConfig();
|
|
339
|
+
case 10:
|
|
340
|
+
publish(APP_CONFIG_INITIALIZED);
|
|
341
|
+
|
|
342
|
+
// Logging
|
|
343
|
+
configureLogging(loggingService, {
|
|
344
|
+
config: getConfig()
|
|
345
|
+
});
|
|
346
|
+
_context6.next = 14;
|
|
347
|
+
return handlers.logging();
|
|
348
|
+
case 14:
|
|
349
|
+
publish(APP_LOGGING_INITIALIZED);
|
|
350
|
+
|
|
351
|
+
// Authentication
|
|
352
|
+
configureAuth(authService, {
|
|
353
|
+
loggingService: getLoggingService(),
|
|
354
|
+
config: getConfig(),
|
|
355
|
+
middleware: authMiddleware
|
|
356
|
+
});
|
|
357
|
+
_context6.next = 18;
|
|
358
|
+
return handlers.auth(requireUser, hydrateUser);
|
|
359
|
+
case 18:
|
|
360
|
+
publish(APP_AUTH_INITIALIZED);
|
|
361
|
+
|
|
362
|
+
// Analytics
|
|
363
|
+
configureAnalytics(analyticsService, {
|
|
364
|
+
config: getConfig(),
|
|
365
|
+
loggingService: getLoggingService(),
|
|
366
|
+
httpClient: getAuthenticatedHttpClient()
|
|
367
|
+
});
|
|
368
|
+
_context6.next = 22;
|
|
369
|
+
return handlers.analytics();
|
|
370
|
+
case 22:
|
|
371
|
+
publish(APP_ANALYTICS_INITIALIZED);
|
|
372
|
+
|
|
373
|
+
// Internationalization
|
|
374
|
+
configureI18n({
|
|
375
|
+
messages: messages,
|
|
376
|
+
config: getConfig(),
|
|
377
|
+
loggingService: getLoggingService()
|
|
378
|
+
});
|
|
379
|
+
_context6.next = 26;
|
|
380
|
+
return handlers.i18n();
|
|
381
|
+
case 26:
|
|
382
|
+
publish(APP_I18N_INITIALIZED);
|
|
383
|
+
|
|
384
|
+
// Application Ready
|
|
385
|
+
_context6.next = 29;
|
|
386
|
+
return handlers.ready();
|
|
387
|
+
case 29:
|
|
388
|
+
publish(APP_READY);
|
|
389
|
+
_context6.next = 38;
|
|
390
|
+
break;
|
|
391
|
+
case 32:
|
|
392
|
+
_context6.prev = 32;
|
|
393
|
+
_context6.t0 = _context6["catch"](2);
|
|
394
|
+
if (_context6.t0.isRedirecting) {
|
|
435
395
|
_context6.next = 38;
|
|
436
396
|
break;
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
_context6.next = 37;
|
|
448
|
-
return handlers.initError(_context6.t0);
|
|
449
|
-
|
|
450
|
-
case 37:
|
|
451
|
-
publish(APP_INIT_ERROR, _context6.t0);
|
|
452
|
-
|
|
453
|
-
case 38:
|
|
454
|
-
case "end":
|
|
455
|
-
return _context6.stop();
|
|
456
|
-
}
|
|
397
|
+
}
|
|
398
|
+
_context6.next = 37;
|
|
399
|
+
return handlers.initError(_context6.t0);
|
|
400
|
+
case 37:
|
|
401
|
+
publish(APP_INIT_ERROR, _context6.t0);
|
|
402
|
+
case 38:
|
|
403
|
+
case "end":
|
|
404
|
+
return _context6.stop();
|
|
457
405
|
}
|
|
458
406
|
}, _callee6, null, [[2, 32]]);
|
|
459
407
|
}));
|