@edx/frontend-platform 2.4.0 → 2.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/auth/AxiosCsrfTokenService.js +6 -2
  2. package/auth/AxiosCsrfTokenService.js.map +1 -1
  3. package/auth/AxiosJwtAuthService.js +10 -6
  4. package/auth/AxiosJwtAuthService.js.map +1 -1
  5. package/auth/AxiosJwtTokenService.js +8 -4
  6. package/auth/AxiosJwtTokenService.js.map +1 -1
  7. package/auth/LocalForageCache.js +8 -4
  8. package/auth/LocalForageCache.js.map +1 -1
  9. package/auth/MockAuthService.js.map +1 -1
  10. package/auth/interceptors/createCsrfTokenProviderInterceptor.js +6 -2
  11. package/auth/interceptors/createCsrfTokenProviderInterceptor.js.map +1 -1
  12. package/auth/interceptors/createJwtTokenProviderInterceptor.js +6 -2
  13. package/auth/interceptors/createJwtTokenProviderInterceptor.js.map +1 -1
  14. package/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js +6 -2
  15. package/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js.map +1 -1
  16. package/auth/interceptors/createRetryInterceptor.js +9 -5
  17. package/auth/interceptors/createRetryInterceptor.js.map +1 -1
  18. package/auth/interface.js +10 -6
  19. package/auth/interface.js.map +1 -1
  20. package/config.js +5 -1
  21. package/config.js.map +1 -1
  22. package/i18n/countries.js +13 -13
  23. package/i18n/countries.js.map +1 -1
  24. package/i18n/injectIntlWithShim.js +3 -3
  25. package/i18n/languages.js +5 -5
  26. package/i18n/languages.js.map +1 -1
  27. package/initialize.js +126 -51
  28. package/initialize.js.map +1 -1
  29. package/package.json +4 -5
  30. package/react/AppProvider.js +10 -7
  31. package/react/AppProvider.js.map +1 -1
  32. package/react/ErrorBoundary.js +2 -2
  33. package/react/ErrorPage.js +49 -64
  34. package/react/ErrorPage.js.map +1 -1
  35. package/react/OptionalReduxProvider.js +1 -1
  36. package/react/OptionalReduxProvider.js.map +1 -1
  37. package/react/PageRoute.js +2 -1
  38. package/react/PageRoute.js.map +1 -1
  39. package/react/hooks.js +1 -1
  40. package/react/hooks.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"languages.js","names":["LANGUAGES","langs","languageLangs","getPrimaryLanguageSubtag","registerLocale","require","getLanguageMessages","locale","primaryLanguageSubtag","languageCode","includes","getNames","getLanguageList","languageMessages","Object","entries","map","code","name"],"sources":["../../src/i18n/languages.js"],"sourcesContent":["import LANGUAGES, { langs as languageLangs } from '@cospired/i18n-iso-languages';\n\nimport { getPrimaryLanguageSubtag } from './lib';\n\n/*\n * LANGUAGE LISTS\n *\n * Lists of language names localized in supported languages.\n *\n * TODO: When we start dynamically loading translations only for the current locale, change this.\n * TODO: Also note that a bunch of languages are missing here. They're present but commented out\n * for reference. That's because they're not implemented in this library. If you read this and it's\n * been a while, go check and see if that's changed!\n */\n\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ar.json'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/en.json'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/es.json'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/fr.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/zh.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ca.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/he.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/id.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ko.json'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/pl.json'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/pt.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ru.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/th.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/uk.json'));\n\n/**\n * Provides a lookup table of language IDs to language names for the current locale.\n *\n * @memberof I18n\n */\nexport const getLanguageMessages = (locale) => {\n const primaryLanguageSubtag = getPrimaryLanguageSubtag(locale);\n const languageCode = languageLangs().includes(primaryLanguageSubtag) ? primaryLanguageSubtag : 'en';\n\n return LANGUAGES.getNames(languageCode);\n};\n\n/**\n * Provides a list of languages represented as objects of the following shape:\n *\n * {\n * key, // The ID of the language\n * name // The localized name of the language\n * }\n *\n * TODO: ARCH-878: The list should be sorted alphabetically in the current locale.\n * This is useful for populating dropdowns.\n *\n * @memberof I18n\n */\nexport const getLanguageList = (locale) => {\n const languageMessages = getLanguageMessages(locale);\n return Object.entries(languageMessages).map(([code, name]) => ({ code, name }));\n};\n"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,SAAP,IAAoBC,KAAK,IAAIC,aAA7B,QAAkD,8BAAlD;AAEA,SAASC,wBAAT,QAAyC,OAAzC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;AACAH,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,4CAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,4CAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,4CAAD,CAAhC,E,CACA;AACA;AACA;AACA;AACA;;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,4CAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,4CAAD,CAAhC,E,CACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACC,MAAD,EAAY;EAC7C,IAAMC,qBAAqB,GAAGL,wBAAwB,CAACI,MAAD,CAAtD;EACA,IAAME,YAAY,GAAGP,aAAa,GAAGQ,QAAhB,CAAyBF,qBAAzB,IAAkDA,qBAAlD,GAA0E,IAA/F;EAEA,OAAOR,SAAS,CAACW,QAAV,CAAmBF,YAAnB,CAAP;AACD,CALM;AAOP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMG,eAAe,GAAG,SAAlBA,eAAkB,CAACL,MAAD,EAAY;EACzC,IAAMM,gBAAgB,GAAGP,mBAAmB,CAACC,MAAD,CAA5C;EACA,OAAOO,MAAM,CAACC,OAAP,CAAeF,gBAAf,EAAiCG,GAAjC,CAAqC;IAAA;IAAA,IAAEC,IAAF;IAAA,IAAQC,IAAR;;IAAA,OAAmB;MAAED,IAAI,EAAJA,IAAF;MAAQC,IAAI,EAAJA;IAAR,CAAnB;EAAA,CAArC,CAAP;AACD,CAHM"}
1
+ {"version":3,"file":"languages.js","names":["LANGUAGES","langs","languageLangs","getPrimaryLanguageSubtag","registerLocale","require","getLanguageMessages","locale","primaryLanguageSubtag","languageCode","includes","getNames","getLanguageList","languageMessages","Object","entries","map","code","name"],"sources":["../../src/i18n/languages.js"],"sourcesContent":["import LANGUAGES, { langs as languageLangs } from '@cospired/i18n-iso-languages';\n\nimport { getPrimaryLanguageSubtag } from './lib';\n\n/*\n * LANGUAGE LISTS\n *\n * Lists of language names localized in supported languages.\n *\n * TODO: When we start dynamically loading translations only for the current locale, change this.\n * TODO: Also note that a bunch of languages are missing here. They're present but commented out\n * for reference. That's because they're not implemented in this library. If you read this and it's\n * been a while, go check and see if that's changed!\n */\n\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ar.json'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/en'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/es'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/fr'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/zh.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ca.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/he.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/id.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ko.json'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/pl'));\nLANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/pt'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ru.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/th.json'));\n// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/uk.json'));\n\n/**\n * Provides a lookup table of language IDs to language names for the current locale.\n *\n * @memberof I18n\n */\nexport const getLanguageMessages = (locale) => {\n const primaryLanguageSubtag = getPrimaryLanguageSubtag(locale);\n const languageCode = languageLangs().includes(primaryLanguageSubtag) ? primaryLanguageSubtag : 'en';\n\n return LANGUAGES.getNames(languageCode);\n};\n\n/**\n * Provides a list of languages represented as objects of the following shape:\n *\n * {\n * key, // The ID of the language\n * name // The localized name of the language\n * }\n *\n * TODO: ARCH-878: The list should be sorted alphabetically in the current locale.\n * This is useful for populating dropdowns.\n *\n * @memberof I18n\n */\nexport const getLanguageList = (locale) => {\n const languageMessages = getLanguageMessages(locale);\n return Object.entries(languageMessages).map(([code, name]) => ({ code, name }));\n};\n"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,SAAP,IAAoBC,KAAK,IAAIC,aAA7B,QAAkD,8BAAlD;AAEA,SAASC,wBAAT,QAAyC,OAAzC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;AACAH,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,uCAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,uCAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,uCAAD,CAAhC,E,CACA;AACA;AACA;AACA;AACA;;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,uCAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,uCAAD,CAAhC,E,CACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACC,MAAD,EAAY;EAC7C,IAAMC,qBAAqB,GAAGL,wBAAwB,CAACI,MAAD,CAAtD;EACA,IAAME,YAAY,GAAGP,aAAa,GAAGQ,QAAhB,CAAyBF,qBAAzB,IAAkDA,qBAAlD,GAA0E,IAA/F;EAEA,OAAOR,SAAS,CAACW,QAAV,CAAmBF,YAAnB,CAAP;AACD,CALM;AAOP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMG,eAAe,GAAG,SAAlBA,eAAkB,CAACL,MAAD,EAAY;EACzC,IAAMM,gBAAgB,GAAGP,mBAAmB,CAACC,MAAD,CAA5C;EACA,OAAOO,MAAM,CAACC,OAAP,CAAeF,gBAAf,EAAiCG,GAAjC,CAAqC;IAAA;IAAA,IAAEC,IAAF;IAAA,IAAQC,IAAR;;IAAA,OAAmB;MAAED,IAAI,EAAJA,IAAF;MAAQC,IAAI,EAAJA;IAAR,CAAnB;EAAA,CAArC,CAAP;AACD,CAHM"}
package/initialize.js CHANGED
@@ -1,9 +1,13 @@
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
+
1
3
  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; }
2
4
 
3
5
  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; }
4
6
 
5
7
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
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
+
7
11
  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); } }
8
12
 
9
13
  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); }); }; }
@@ -57,12 +61,13 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
57
61
  import { createBrowserHistory, createMemoryHistory } from 'history';
58
62
  import { publish } from './pubSub'; // eslint-disable-next-line import/no-cycle
59
63
 
60
- import { getConfig } from './config';
64
+ import { getConfig, mergeConfig } from './config';
61
65
  import { configure as configureLogging, getLoggingService, NewRelicLoggingService, logError } from './logging';
62
66
  import { configure as configureAnalytics, SegmentAnalyticsService, identifyAnonymousUser, identifyAuthenticatedUser } from './analytics';
63
67
  import { getAuthenticatedHttpClient, configure as configureAuth, ensureAuthenticatedUser, fetchAuthenticatedUser, hydrateAuthenticatedUser, getAuthenticatedUser, AxiosJwtAuthService } from './auth';
64
68
  import { configure as configureI18n } from './i18n';
65
69
  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
+ import configureCache from './auth/LocalForageCache';
66
71
  /**
67
72
  * A browser history or memory history object created by the [history](https://github.com/ReactTraining/history)
68
73
  * package. Applications are encouraged to use this history object, rather than creating their own,
@@ -100,8 +105,8 @@ export function initError(_x) {
100
105
  */
101
106
 
102
107
  function _initError() {
103
- _initError = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2(error) {
104
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
108
+ _initError = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(error) {
109
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
105
110
  while (1) {
106
111
  switch (_context2.prev = _context2.next) {
107
112
  case 0:
@@ -120,18 +125,15 @@ function _initError() {
120
125
  export function auth(_x2, _x3) {
121
126
  return _auth.apply(this, arguments);
122
127
  }
123
- /**
124
- * The default handler for the initialization lifecycle's `analytics` phase.
125
- *
126
- * The handler is responsible for identifying authenticated and anonymous users with the analytics
127
- * service. This is a pre-requisite for sending analytics events, thus, we do it during the
128
- * initialization sequence so that analytics is ready once the application's UI code starts to load.
129
- *
128
+ /*
129
+ * Set or overrides configuration through an API.
130
+ * This method allows runtime configuration.
131
+ * Set a basic configuration when an error happen and allow initError and display the ErrorPage.
130
132
  */
131
133
 
132
134
  function _auth() {
133
- _auth = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3(requireUser, hydrateUser) {
134
- return regeneratorRuntime.wrap(function _callee3$(_context3) {
135
+ _auth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(requireUser, hydrateUser) {
136
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
135
137
  while (1) {
136
138
  switch (_context3.prev = _context3.next) {
137
139
  case 0:
@@ -169,46 +171,115 @@ function _auth() {
169
171
  return _auth.apply(this, arguments);
170
172
  }
171
173
 
174
+ export function runtimeConfig() {
175
+ return _runtimeConfig.apply(this, arguments);
176
+ }
177
+ /**
178
+ * The default handler for the initialization lifecycle's `analytics` phase.
179
+ *
180
+ * The handler is responsible for identifying authenticated and anonymous users with the analytics
181
+ * service. This is a pre-requisite for sending analytics events, thus, we do it during the
182
+ * initialization sequence so that analytics is ready once the application's UI code starts to load.
183
+ *
184
+ */
185
+
186
+ function _runtimeConfig() {
187
+ _runtimeConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
188
+ var _getConfig, MFE_CONFIG_API_URL, APP_ID, apiConfig, apiService, params, url, _yield$apiService$get, data;
189
+
190
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
191
+ while (1) {
192
+ switch (_context4.prev = _context4.next) {
193
+ case 0:
194
+ _context4.prev = 0;
195
+ _getConfig = getConfig(), MFE_CONFIG_API_URL = _getConfig.MFE_CONFIG_API_URL, APP_ID = _getConfig.APP_ID;
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;
225
+ break;
226
+
227
+ case 17:
228
+ _context4.prev = 17;
229
+ _context4.t0 = _context4["catch"](0);
230
+ // eslint-disable-next-line no-console
231
+ console.error('Error with config API', _context4.t0.message);
232
+
233
+ case 20:
234
+ case "end":
235
+ return _context4.stop();
236
+ }
237
+ }
238
+ }, _callee4, null, [[0, 17]]);
239
+ }));
240
+ return _runtimeConfig.apply(this, arguments);
241
+ }
242
+
172
243
  export function analytics() {
173
244
  return _analytics.apply(this, arguments);
174
245
  }
175
246
 
176
247
  function _analytics() {
177
- _analytics = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
248
+ _analytics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
178
249
  var authenticatedUser;
179
- return regeneratorRuntime.wrap(function _callee4$(_context4) {
250
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
180
251
  while (1) {
181
- switch (_context4.prev = _context4.next) {
252
+ switch (_context5.prev = _context5.next) {
182
253
  case 0:
183
254
  authenticatedUser = getAuthenticatedUser();
184
255
 
185
256
  if (!(authenticatedUser && authenticatedUser.userId)) {
186
- _context4.next = 5;
257
+ _context5.next = 5;
187
258
  break;
188
259
  }
189
260
 
190
261
  identifyAuthenticatedUser(authenticatedUser.userId);
191
- _context4.next = 7;
262
+ _context5.next = 7;
192
263
  break;
193
264
 
194
265
  case 5:
195
- _context4.next = 7;
266
+ _context5.next = 7;
196
267
  return identifyAnonymousUser();
197
268
 
198
269
  case 7:
199
270
  case "end":
200
- return _context4.stop();
271
+ return _context5.stop();
201
272
  }
202
273
  }
203
- }, _callee4);
274
+ }, _callee5);
204
275
  }));
205
276
  return _analytics.apply(this, arguments);
206
277
  }
207
278
 
208
279
  function applyOverrideHandlers(overrides) {
209
280
  var noOp = /*#__PURE__*/function () {
210
- var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
211
- return regeneratorRuntime.wrap(function _callee$(_context) {
281
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
282
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
212
283
  while (1) {
213
284
  switch (_context.prev = _context.next) {
214
285
  case 0:
@@ -288,35 +359,39 @@ export function initialize(_x4) {
288
359
  }
289
360
 
290
361
  function _initialize() {
291
- _initialize = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5(_ref2) {
362
+ _initialize = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref2) {
292
363
  var _ref2$loggingService, loggingService, _ref2$analyticsServic, analyticsService, _ref2$authService, authService, _ref2$authMiddleware, authMiddleware, _ref2$requireAuthenti, requireUser, _ref2$hydrateAuthenti, hydrateUser, messages, _ref2$handlers, overrideHandlers, handlers;
293
364
 
294
- return regeneratorRuntime.wrap(function _callee5$(_context5) {
365
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
295
366
  while (1) {
296
- switch (_context5.prev = _context5.next) {
367
+ switch (_context6.prev = _context6.next) {
297
368
  case 0:
298
369
  _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;
299
370
  handlers = applyOverrideHandlers(overrideHandlers);
300
- _context5.prev = 2;
301
- _context5.next = 5;
371
+ _context6.prev = 2;
372
+ _context6.next = 5;
302
373
  return handlers.pubSub();
303
374
 
304
375
  case 5:
305
376
  publish(APP_PUBSUB_INITIALIZED); // Configuration
306
377
 
307
- _context5.next = 8;
378
+ _context6.next = 8;
308
379
  return handlers.config();
309
380
 
310
381
  case 8:
382
+ _context6.next = 10;
383
+ return runtimeConfig();
384
+
385
+ case 10:
311
386
  publish(APP_CONFIG_INITIALIZED); // Logging
312
387
 
313
388
  configureLogging(loggingService, {
314
389
  config: getConfig()
315
390
  });
316
- _context5.next = 12;
391
+ _context6.next = 14;
317
392
  return handlers.logging();
318
393
 
319
- case 12:
394
+ case 14:
320
395
  publish(APP_LOGGING_INITIALIZED); // Authentication
321
396
 
322
397
  configureAuth(authService, {
@@ -324,10 +399,10 @@ function _initialize() {
324
399
  config: getConfig(),
325
400
  middleware: authMiddleware
326
401
  });
327
- _context5.next = 16;
402
+ _context6.next = 18;
328
403
  return handlers.auth(requireUser, hydrateUser);
329
404
 
330
- case 16:
405
+ case 18:
331
406
  publish(APP_AUTH_INITIALIZED); // Analytics
332
407
 
333
408
  configureAnalytics(analyticsService, {
@@ -335,10 +410,10 @@ function _initialize() {
335
410
  loggingService: getLoggingService(),
336
411
  httpClient: getAuthenticatedHttpClient()
337
412
  });
338
- _context5.next = 20;
413
+ _context6.next = 22;
339
414
  return handlers.analytics();
340
415
 
341
- case 20:
416
+ case 22:
342
417
  publish(APP_ANALYTICS_INITIALIZED); // Internationalization
343
418
 
344
419
  configureI18n({
@@ -346,41 +421,41 @@ function _initialize() {
346
421
  config: getConfig(),
347
422
  loggingService: getLoggingService()
348
423
  });
349
- _context5.next = 24;
424
+ _context6.next = 26;
350
425
  return handlers.i18n();
351
426
 
352
- case 24:
427
+ case 26:
353
428
  publish(APP_I18N_INITIALIZED); // Application Ready
354
429
 
355
- _context5.next = 27;
430
+ _context6.next = 29;
356
431
  return handlers.ready();
357
432
 
358
- case 27:
433
+ case 29:
359
434
  publish(APP_READY);
360
- _context5.next = 36;
435
+ _context6.next = 38;
361
436
  break;
362
437
 
363
- case 30:
364
- _context5.prev = 30;
365
- _context5.t0 = _context5["catch"](2);
438
+ case 32:
439
+ _context6.prev = 32;
440
+ _context6.t0 = _context6["catch"](2);
366
441
 
367
- if (_context5.t0.isRedirecting) {
368
- _context5.next = 36;
442
+ if (_context6.t0.isRedirecting) {
443
+ _context6.next = 38;
369
444
  break;
370
445
  }
371
446
 
372
- _context5.next = 35;
373
- return handlers.initError(_context5.t0);
447
+ _context6.next = 37;
448
+ return handlers.initError(_context6.t0);
374
449
 
375
- case 35:
376
- publish(APP_INIT_ERROR, _context5.t0);
450
+ case 37:
451
+ publish(APP_INIT_ERROR, _context6.t0);
377
452
 
378
- case 36:
453
+ case 38:
379
454
  case "end":
380
- return _context5.stop();
455
+ return _context6.stop();
381
456
  }
382
457
  }
383
- }, _callee5, null, [[2, 30]]);
458
+ }, _callee6, null, [[2, 32]]);
384
459
  }));
385
460
  return _initialize.apply(this, arguments);
386
461
  }
package/initialize.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"initialize.js","names":["createBrowserHistory","createMemoryHistory","publish","getConfig","configure","configureLogging","getLoggingService","NewRelicLoggingService","logError","configureAnalytics","SegmentAnalyticsService","identifyAnonymousUser","identifyAuthenticatedUser","getAuthenticatedHttpClient","configureAuth","ensureAuthenticatedUser","fetchAuthenticatedUser","hydrateAuthenticatedUser","getAuthenticatedUser","AxiosJwtAuthService","configureI18n","APP_PUBSUB_INITIALIZED","APP_CONFIG_INITIALIZED","APP_AUTH_INITIALIZED","APP_I18N_INITIALIZED","APP_LOGGING_INITIALIZED","APP_ANALYTICS_INITIALIZED","APP_READY","APP_INIT_ERROR","history","window","basename","PUBLIC_PATH","initError","error","auth","requireUser","hydrateUser","global","location","href","analytics","authenticatedUser","userId","applyOverrideHandlers","overrides","noOp","pubSub","config","logging","i18n","ready","initialize","loggingService","analyticsService","authService","authMiddleware","requireAuthenticatedUser","messages","handlers","overrideHandlers","middleware","httpClient","isRedirecting"],"sources":["../src/initialize.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform**\n *\n * The initialization module provides a function for managing an application's initialization\n * lifecycle. It also provides constants and default handler implementations.\n *\n * ```\n * import {\n * initialize,\n * APP_INIT_ERROR,\n * APP_READY,\n * subscribe,\n * } from '@edx/frontend-platform';\n * import { AppProvider, ErrorPage, PageRoute } from '@edx/frontend-platform/react';\n * import React from 'react';\n * import ReactDOM from 'react-dom';\n * import { Switch } from 'react-router-dom';\n *\n * subscribe(APP_READY, () => {\n * ReactDOM.render(\n * <AppProvider store={configureStore()}>\n * <Header />\n * <main>\n * <Switch>\n * <PageRoute exact path=\"/\" component={PaymentPage} />\n * </Switch>\n * </main>\n * <Footer />\n * </AppProvider>,\n * document.getElementById('root'),\n * );\n * });\n *\n * subscribe(APP_INIT_ERROR, (error) => {\n * ReactDOM.render(<ErrorPage message={error.message} />, document.getElementById('root'));\n * });\n *\n * initialize({\n * messages: [appMessages],\n * requireAuthenticatedUser: true,\n * hydrateAuthenticatedUser: true,\n * });\n\n```\n * @module Initialization\n */\n\nimport { createBrowserHistory, createMemoryHistory } from 'history';\nimport {\n publish,\n} from './pubSub';\n// eslint-disable-next-line import/no-cycle\nimport { getConfig } from './config';\nimport {\n configure as configureLogging, getLoggingService, NewRelicLoggingService, logError,\n} from './logging';\nimport {\n configure as configureAnalytics, SegmentAnalyticsService, identifyAnonymousUser, identifyAuthenticatedUser,\n} from './analytics';\nimport {\n getAuthenticatedHttpClient,\n configure as configureAuth,\n ensureAuthenticatedUser,\n fetchAuthenticatedUser,\n hydrateAuthenticatedUser,\n getAuthenticatedUser,\n AxiosJwtAuthService,\n} from './auth';\nimport { configure as configureI18n } from './i18n';\nimport {\n APP_PUBSUB_INITIALIZED,\n APP_CONFIG_INITIALIZED,\n APP_AUTH_INITIALIZED,\n APP_I18N_INITIALIZED,\n APP_LOGGING_INITIALIZED,\n APP_ANALYTICS_INITIALIZED,\n APP_READY, APP_INIT_ERROR,\n} from './constants';\n\n/**\n * A browser history or memory history object created by the [history](https://github.com/ReactTraining/history)\n * package. Applications are encouraged to use this history object, rather than creating their own,\n * as behavior may be undefined when managing history via multiple mechanisms/instances. Note that\n * in environments where browser history may be inaccessible due to `window` being undefined, this\n * falls back to memory history.\n */\nexport const history = (typeof window !== 'undefined')\n ? createBrowserHistory({\n basename: getConfig().PUBLIC_PATH,\n }) : createMemoryHistory();\n\n/**\n * The default handler for the initialization lifecycle's `initError` phase. Logs the error to the\n * LoggingService using `logError`\n *\n * @see {@link module:frontend-platform/logging~logError}\n * @param {*} error\n */\nexport async function initError(error) {\n logError(error);\n}\n\n/**\n * The default handler for the initialization lifecycle's `auth` phase.\n *\n * The handler has several responsibilities:\n * - Determining the user's authentication state (authenticated or anonymous)\n * - Optionally redirecting to login if the application requires an authenticated user.\n * - Optionally loading additional user information via the application's user account data\n * endpoint.\n *\n * @param {boolean} requireUser Whether or not we should redirect to login if a user is not\n * authenticated.\n * @param {boolean} hydrateUser Whether or not we should fetch additional user account data.\n */\nexport async function auth(requireUser, hydrateUser) {\n if (requireUser) {\n await ensureAuthenticatedUser(global.location.href);\n } else {\n await fetchAuthenticatedUser();\n }\n\n if (hydrateUser && getAuthenticatedUser() !== null) {\n // We intentionally do not await the promise returned by hydrateAuthenticatedUser. All the\n // critical data is returned as part of fetch/ensureAuthenticatedUser above, and anything else\n // is a nice-to-have for application code.\n hydrateAuthenticatedUser();\n }\n}\n\n/**\n * The default handler for the initialization lifecycle's `analytics` phase.\n *\n * The handler is responsible for identifying authenticated and anonymous users with the analytics\n * service. This is a pre-requisite for sending analytics events, thus, we do it during the\n * initialization sequence so that analytics is ready once the application's UI code starts to load.\n *\n */\nexport async function analytics() {\n const authenticatedUser = getAuthenticatedUser();\n if (authenticatedUser && authenticatedUser.userId) {\n identifyAuthenticatedUser(authenticatedUser.userId);\n } else {\n await identifyAnonymousUser();\n }\n}\n\nfunction applyOverrideHandlers(overrides) {\n const noOp = async () => { };\n return {\n pubSub: noOp,\n config: noOp,\n logging: noOp,\n auth,\n analytics,\n i18n: noOp,\n ready: noOp,\n initError,\n ...overrides, // This will override any same-keyed handlers from above.\n };\n}\n\n/**\n * Invokes the application initialization sequence.\n *\n * The sequence proceeds through a number of lifecycle phases, during which pertinent services are\n * configured.\n *\n * Using the `handlers` option, lifecycle phase handlers can be overridden to perform custom\n * functionality. Note that while these override handlers _do_ replace the default handler\n * functionality for analytics, auth, and initError (the other phases have no default\n * functionality), they do _not_ override the configuration of the actual services that those\n * handlers leverage.\n *\n * Some services can be overridden via the loggingService and analyticsService options. The other\n * services (auth and i18n) cannot currently be overridden.\n *\n * The following lifecycle phases exist:\n *\n * - pubSub: A no-op by default.\n * - config: A no-op by default.\n * - logging: A no-op by default.\n * - auth: Uses the 'auth' handler defined above.\n * - analytics: Uses the 'analytics' handler defined above.\n * - i18n: A no-op by default.\n * - ready: A no-op by default.\n * - initError: Uses the 'initError' handler defined above.\n *\n * @param {Object} [options]\n * @param {*} [options.loggingService=NewRelicLoggingService] The `LoggingService` implementation\n * to use.\n * @param {*} [options.analyticsService=SegmentAnalyticsService] The `AnalyticsService`\n * implementation to use.\n * @param {*} [options.authMiddleware=[]] An array of middleware to apply to http clients in the auth service.\n * @param {*} [options.requireAuthenticatedUser=false] If true, turns on automatic login\n * redirection for unauthenticated users. Defaults to false, meaning that by default the\n * application will allow anonymous/unauthenticated sessions.\n * @param {*} [options.hydrateAuthenticatedUser=false] If true, makes an API call to the user\n * account endpoint (`${App.config.LMS_BASE_URL}/api/user/v1/accounts/${username}`) to fetch\n * detailed account information for the authenticated user. This data is merged into the return\n * value of `getAuthenticatedUser`, overriding any duplicate keys that already exist. Defaults to\n * false, meaning that no additional account information will be loaded.\n * @param {*} [options.messages] A i18n-compatible messages object, or an array of such objects. If\n * an array is provided, duplicate keys are resolved with the last-one-in winning.\n * @param {*} [options.handlers={}] An optional object of handlers which can be used to replace the\n * default behavior of any part of the startup sequence. It can also be used to add additional\n * initialization behavior before or after the rest of the sequence.\n */\nexport async function initialize({\n loggingService = NewRelicLoggingService,\n analyticsService = SegmentAnalyticsService,\n authService = AxiosJwtAuthService,\n authMiddleware = [],\n requireAuthenticatedUser: requireUser = false,\n hydrateAuthenticatedUser: hydrateUser = false,\n messages,\n handlers: overrideHandlers = {},\n}) {\n const handlers = applyOverrideHandlers(overrideHandlers);\n try {\n // Pub/Sub\n await handlers.pubSub();\n publish(APP_PUBSUB_INITIALIZED);\n\n // Configuration\n await handlers.config();\n publish(APP_CONFIG_INITIALIZED);\n\n // Logging\n configureLogging(loggingService, {\n config: getConfig(),\n });\n await handlers.logging();\n publish(APP_LOGGING_INITIALIZED);\n\n // Authentication\n configureAuth(authService, {\n loggingService: getLoggingService(),\n config: getConfig(),\n middleware: authMiddleware,\n });\n\n await handlers.auth(requireUser, hydrateUser);\n publish(APP_AUTH_INITIALIZED);\n\n // Analytics\n configureAnalytics(analyticsService, {\n config: getConfig(),\n loggingService: getLoggingService(),\n httpClient: getAuthenticatedHttpClient(),\n });\n await handlers.analytics();\n publish(APP_ANALYTICS_INITIALIZED);\n\n // Internationalization\n configureI18n({\n messages,\n config: getConfig(),\n loggingService: getLoggingService(),\n });\n await handlers.i18n();\n publish(APP_I18N_INITIALIZED);\n\n // Application Ready\n await handlers.ready();\n publish(APP_READY);\n } catch (error) {\n if (!error.isRedirecting) {\n // Initialization Error\n await handlers.initError(error);\n publish(APP_INIT_ERROR, error);\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,SAASA,oBAAT,EAA+BC,mBAA/B,QAA0D,SAA1D;AACA,SACEC,OADF,QAEO,UAFP,C,CAGA;;AACA,SAASC,SAAT,QAA0B,UAA1B;AACA,SACEC,SAAS,IAAIC,gBADf,EACiCC,iBADjC,EACoDC,sBADpD,EAC4EC,QAD5E,QAEO,WAFP;AAGA,SACEJ,SAAS,IAAIK,kBADf,EACmCC,uBADnC,EAC4DC,qBAD5D,EACmFC,yBADnF,QAEO,aAFP;AAGA,SACEC,0BADF,EAEET,SAAS,IAAIU,aAFf,EAGEC,uBAHF,EAIEC,sBAJF,EAKEC,wBALF,EAMEC,oBANF,EAOEC,mBAPF,QAQO,QARP;AASA,SAASf,SAAS,IAAIgB,aAAtB,QAA2C,QAA3C;AACA,SACEC,sBADF,EAEEC,sBAFF,EAGEC,oBAHF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;UAAA;YAyDHjD,OAAO,CAACyB,SAAD,CAAP;YAzDG;YAAA;;UAAA;YAAA;YAAA;;YAAA,IA2DE,aAAMoC,aA3DR;cAAA;cAAA;YAAA;;YAAA;YAAA,OA6DKJ,QAAQ,CAAC1B,SAAT,cA7DL;;UAAA;YA8DD/B,OAAO,CAAC0B,cAAD,eAAP;;UA9DC;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,C"}
1
+ {"version":3,"file":"initialize.js","names":["createBrowserHistory","createMemoryHistory","publish","getConfig","mergeConfig","configure","configureLogging","getLoggingService","NewRelicLoggingService","logError","configureAnalytics","SegmentAnalyticsService","identifyAnonymousUser","identifyAuthenticatedUser","getAuthenticatedHttpClient","configureAuth","ensureAuthenticatedUser","fetchAuthenticatedUser","hydrateAuthenticatedUser","getAuthenticatedUser","AxiosJwtAuthService","configureI18n","APP_PUBSUB_INITIALIZED","APP_CONFIG_INITIALIZED","APP_AUTH_INITIALIZED","APP_I18N_INITIALIZED","APP_LOGGING_INITIALIZED","APP_ANALYTICS_INITIALIZED","APP_READY","APP_INIT_ERROR","configureCache","history","window","basename","PUBLIC_PATH","initError","error","auth","requireUser","hydrateUser","global","location","href","runtimeConfig","MFE_CONFIG_API_URL","APP_ID","apiConfig","headers","accept","apiService","params","URLSearchParams","append","url","toString","get","data","console","message","analytics","authenticatedUser","userId","applyOverrideHandlers","overrides","noOp","pubSub","config","logging","i18n","ready","initialize","loggingService","analyticsService","authService","authMiddleware","requireAuthenticatedUser","messages","handlers","overrideHandlers","middleware","httpClient","isRedirecting"],"sources":["../src/initialize.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform**\n *\n * The initialization module provides a function for managing an application's initialization\n * lifecycle. It also provides constants and default handler implementations.\n *\n * ```\n * import {\n * initialize,\n * APP_INIT_ERROR,\n * APP_READY,\n * subscribe,\n * } from '@edx/frontend-platform';\n * import { AppProvider, ErrorPage, PageRoute } from '@edx/frontend-platform/react';\n * import React from 'react';\n * import ReactDOM from 'react-dom';\n * import { Switch } from 'react-router-dom';\n *\n * subscribe(APP_READY, () => {\n * ReactDOM.render(\n * <AppProvider store={configureStore()}>\n * <Header />\n * <main>\n * <Switch>\n * <PageRoute exact path=\"/\" component={PaymentPage} />\n * </Switch>\n * </main>\n * <Footer />\n * </AppProvider>,\n * document.getElementById('root'),\n * );\n * });\n *\n * subscribe(APP_INIT_ERROR, (error) => {\n * ReactDOM.render(<ErrorPage message={error.message} />, document.getElementById('root'));\n * });\n *\n * initialize({\n * messages: [appMessages],\n * requireAuthenticatedUser: true,\n * hydrateAuthenticatedUser: true,\n * });\n\n```\n * @module Initialization\n */\n\nimport { createBrowserHistory, createMemoryHistory } from 'history';\nimport {\n publish,\n} from './pubSub';\n// eslint-disable-next-line import/no-cycle\nimport {\n getConfig, mergeConfig,\n} from './config';\nimport {\n configure as configureLogging, getLoggingService, NewRelicLoggingService, logError,\n} from './logging';\nimport {\n configure as configureAnalytics, SegmentAnalyticsService, identifyAnonymousUser, identifyAuthenticatedUser,\n} from './analytics';\nimport {\n getAuthenticatedHttpClient,\n configure as configureAuth,\n ensureAuthenticatedUser,\n fetchAuthenticatedUser,\n hydrateAuthenticatedUser,\n getAuthenticatedUser,\n AxiosJwtAuthService,\n} from './auth';\nimport { configure as configureI18n } from './i18n';\nimport {\n APP_PUBSUB_INITIALIZED,\n APP_CONFIG_INITIALIZED,\n APP_AUTH_INITIALIZED,\n APP_I18N_INITIALIZED,\n APP_LOGGING_INITIALIZED,\n APP_ANALYTICS_INITIALIZED,\n APP_READY, APP_INIT_ERROR,\n} from './constants';\nimport configureCache from './auth/LocalForageCache';\n\n/**\n * A browser history or memory history object created by the [history](https://github.com/ReactTraining/history)\n * package. Applications are encouraged to use this history object, rather than creating their own,\n * as behavior may be undefined when managing history via multiple mechanisms/instances. Note that\n * in environments where browser history may be inaccessible due to `window` being undefined, this\n * falls back to memory history.\n */\nexport const history = (typeof window !== 'undefined')\n ? createBrowserHistory({\n basename: getConfig().PUBLIC_PATH,\n }) : createMemoryHistory();\n\n/**\n * The default handler for the initialization lifecycle's `initError` phase. Logs the error to the\n * LoggingService using `logError`\n *\n * @see {@link module:frontend-platform/logging~logError}\n * @param {*} error\n */\nexport async function initError(error) {\n logError(error);\n}\n\n/**\n * The default handler for the initialization lifecycle's `auth` phase.\n *\n * The handler has several responsibilities:\n * - Determining the user's authentication state (authenticated or anonymous)\n * - Optionally redirecting to login if the application requires an authenticated user.\n * - Optionally loading additional user information via the application's user account data\n * endpoint.\n *\n * @param {boolean} requireUser Whether or not we should redirect to login if a user is not\n * authenticated.\n * @param {boolean} hydrateUser Whether or not we should fetch additional user account data.\n */\nexport async function auth(requireUser, hydrateUser) {\n if (requireUser) {\n await ensureAuthenticatedUser(global.location.href);\n } else {\n await fetchAuthenticatedUser();\n }\n\n if (hydrateUser && getAuthenticatedUser() !== null) {\n // We intentionally do not await the promise returned by hydrateAuthenticatedUser. All the\n // critical data is returned as part of fetch/ensureAuthenticatedUser above, and anything else\n // is a nice-to-have for application code.\n hydrateAuthenticatedUser();\n }\n}\n/*\n * Set or overrides configuration through an API.\n * This method allows runtime configuration.\n * Set a basic configuration when an error happen and allow initError and display the ErrorPage.\n */\n\nexport async function runtimeConfig() {\n try {\n const { MFE_CONFIG_API_URL, APP_ID } = getConfig();\n\n if (MFE_CONFIG_API_URL) {\n const apiConfig = { headers: { accept: 'application/json' } };\n const apiService = await configureCache();\n\n const params = new URLSearchParams();\n params.append('mfe', APP_ID);\n const url = `${MFE_CONFIG_API_URL}?${params.toString()}`;\n\n const { data } = await apiService.get(url, apiConfig);\n mergeConfig(data);\n }\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error('Error with config API', error.message);\n }\n}\n\n/**\n * The default handler for the initialization lifecycle's `analytics` phase.\n *\n * The handler is responsible for identifying authenticated and anonymous users with the analytics\n * service. This is a pre-requisite for sending analytics events, thus, we do it during the\n * initialization sequence so that analytics is ready once the application's UI code starts to load.\n *\n */\nexport async function analytics() {\n const authenticatedUser = getAuthenticatedUser();\n if (authenticatedUser && authenticatedUser.userId) {\n identifyAuthenticatedUser(authenticatedUser.userId);\n } else {\n await identifyAnonymousUser();\n }\n}\n\nfunction applyOverrideHandlers(overrides) {\n const noOp = async () => { };\n return {\n pubSub: noOp,\n config: noOp,\n logging: noOp,\n auth,\n analytics,\n i18n: noOp,\n ready: noOp,\n initError,\n ...overrides, // This will override any same-keyed handlers from above.\n };\n}\n\n/**\n * Invokes the application initialization sequence.\n *\n * The sequence proceeds through a number of lifecycle phases, during which pertinent services are\n * configured.\n *\n * Using the `handlers` option, lifecycle phase handlers can be overridden to perform custom\n * functionality. Note that while these override handlers _do_ replace the default handler\n * functionality for analytics, auth, and initError (the other phases have no default\n * functionality), they do _not_ override the configuration of the actual services that those\n * handlers leverage.\n *\n * Some services can be overridden via the loggingService and analyticsService options. The other\n * services (auth and i18n) cannot currently be overridden.\n *\n * The following lifecycle phases exist:\n *\n * - pubSub: A no-op by default.\n * - config: A no-op by default.\n * - logging: A no-op by default.\n * - auth: Uses the 'auth' handler defined above.\n * - analytics: Uses the 'analytics' handler defined above.\n * - i18n: A no-op by default.\n * - ready: A no-op by default.\n * - initError: Uses the 'initError' handler defined above.\n *\n * @param {Object} [options]\n * @param {*} [options.loggingService=NewRelicLoggingService] The `LoggingService` implementation\n * to use.\n * @param {*} [options.analyticsService=SegmentAnalyticsService] The `AnalyticsService`\n * implementation to use.\n * @param {*} [options.authMiddleware=[]] An array of middleware to apply to http clients in the auth service.\n * @param {*} [options.requireAuthenticatedUser=false] If true, turns on automatic login\n * redirection for unauthenticated users. Defaults to false, meaning that by default the\n * application will allow anonymous/unauthenticated sessions.\n * @param {*} [options.hydrateAuthenticatedUser=false] If true, makes an API call to the user\n * account endpoint (`${App.config.LMS_BASE_URL}/api/user/v1/accounts/${username}`) to fetch\n * detailed account information for the authenticated user. This data is merged into the return\n * value of `getAuthenticatedUser`, overriding any duplicate keys that already exist. Defaults to\n * false, meaning that no additional account information will be loaded.\n * @param {*} [options.messages] A i18n-compatible messages object, or an array of such objects. If\n * an array is provided, duplicate keys are resolved with the last-one-in winning.\n * @param {*} [options.handlers={}] An optional object of handlers which can be used to replace the\n * default behavior of any part of the startup sequence. It can also be used to add additional\n * initialization behavior before or after the rest of the sequence.\n */\nexport async function initialize({\n loggingService = NewRelicLoggingService,\n analyticsService = SegmentAnalyticsService,\n authService = AxiosJwtAuthService,\n authMiddleware = [],\n requireAuthenticatedUser: requireUser = false,\n hydrateAuthenticatedUser: hydrateUser = false,\n messages,\n handlers: overrideHandlers = {},\n}) {\n const handlers = applyOverrideHandlers(overrideHandlers);\n try {\n // Pub/Sub\n await handlers.pubSub();\n publish(APP_PUBSUB_INITIALIZED);\n\n // Configuration\n await handlers.config();\n await runtimeConfig();\n publish(APP_CONFIG_INITIALIZED);\n\n // Logging\n configureLogging(loggingService, {\n config: getConfig(),\n });\n await handlers.logging();\n publish(APP_LOGGING_INITIALIZED);\n\n // Authentication\n configureAuth(authService, {\n loggingService: getLoggingService(),\n config: getConfig(),\n middleware: authMiddleware,\n });\n\n await handlers.auth(requireUser, hydrateUser);\n publish(APP_AUTH_INITIALIZED);\n\n // Analytics\n configureAnalytics(analyticsService, {\n config: getConfig(),\n loggingService: getLoggingService(),\n httpClient: getAuthenticatedHttpClient(),\n });\n await handlers.analytics();\n publish(APP_ANALYTICS_INITIALIZED);\n\n // Internationalization\n configureI18n({\n messages,\n config: getConfig(),\n loggingService: getLoggingService(),\n });\n await handlers.i18n();\n publish(APP_I18N_INITIALIZED);\n\n // Application Ready\n await handlers.ready();\n publish(APP_READY);\n } catch (error) {\n if (!error.isRedirecting) {\n // Initialization Error\n await handlers.initError(error);\n publish(APP_INIT_ERROR, error);\n }\n }\n}\n"],"mappings":";;;;;;;;+CACA,oJ;;;;;;AADA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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YACAN,aAAa,CAAC;cACZuD,QAAQ,EAARA,QADY;cAEZV,MAAM,EAAE/D,SAAS,EAFL;cAGZoE,cAAc,EAAEhE,iBAAiB;YAHrB,CAAD,CAAb;YAhDG;YAAA,OAqDGsE,QAAQ,CAACT,IAAT,EArDH;;UAAA;YAsDHlE,OAAO,CAACuB,oBAAD,CAAP,CAtDG,CAwDH;;YAxDG;YAAA,OAyDGoD,QAAQ,CAACR,KAAT,EAzDH;;UAAA;YA0DHnE,OAAO,CAAC0B,SAAD,CAAP;YA1DG;YAAA;;UAAA;YAAA;YAAA;;YAAA,IA4DE,aAAMqD,aA5DR;cAAA;cAAA;YAAA;;YAAA;YAAA,OA8DKJ,QAAQ,CAAC1C,SAAT,cA9DL;;UAAA;YA+DDjC,OAAO,CAAC2B,cAAD,eAAP;;UA/DC;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edx/frontend-platform",
3
- "version": "2.4.0",
3
+ "version": "2.5.2",
4
4
  "description": "Foundational application framework for Open edX micro-frontend applications.",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
@@ -32,10 +32,9 @@
32
32
  "homepage": "https://github.com/edx/frontend-platform#readme",
33
33
  "devDependencies": {
34
34
  "@edx/brand": "npm:@edx/brand-openedx@1.1.0",
35
- "@edx/frontend-build": "9.2.2",
35
+ "@edx/frontend-build": "^12.0.3",
36
36
  "@edx/paragon": "20.2.0",
37
37
  "axios-mock-adapter": "1.20.0",
38
- "codecov": "3.8.3",
39
38
  "core-js": "3.21.1",
40
39
  "enzyme": "3.11.0",
41
40
  "enzyme-adapter-react-16": "1.15.6",
@@ -52,8 +51,8 @@
52
51
  },
53
52
  "dependencies": {
54
53
  "@cospired/i18n-iso-languages": "2.2.0",
55
- "@formatjs/intl-pluralrules": "^4.3.3",
56
- "@formatjs/intl-relativetimeformat": "^10.0.1",
54
+ "@formatjs/intl-pluralrules": "4.3.3",
55
+ "@formatjs/intl-relativetimeformat": "10.0.1",
57
56
  "axios": "0.26.1",
58
57
  "axios-cache-adapter": "2.7.3",
59
58
  "form-urlencoded": "4.1.4",
@@ -10,7 +10,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
10
10
 
11
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
13
- import React, { useState } from 'react';
13
+ import React, { useState, useMemo } from 'react';
14
14
  import PropTypes from 'prop-types';
15
15
  import { Router } from 'react-router-dom';
16
16
  import OptionalReduxProvider from './OptionalReduxProvider';
@@ -77,20 +77,23 @@ export default function AppProvider(_ref) {
77
77
  useAppEvent(LOCALE_CHANGED, function () {
78
78
  setLocale(getLocale());
79
79
  });
80
+ var appContextValue = useMemo(function () {
81
+ return {
82
+ authenticatedUser: authenticatedUser,
83
+ config: config,
84
+ locale: locale
85
+ };
86
+ }, [authenticatedUser, config, locale]);
80
87
  return /*#__PURE__*/React.createElement(IntlProvider, {
81
88
  locale: locale,
82
89
  messages: getMessages()
83
90
  }, /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(AppContext.Provider, {
84
- value: {
85
- authenticatedUser: authenticatedUser,
86
- config: config,
87
- locale: locale
88
- }
91
+ value: appContextValue
89
92
  }, /*#__PURE__*/React.createElement(OptionalReduxProvider, {
90
93
  store: store
91
94
  }, /*#__PURE__*/React.createElement(Router, {
92
95
  history: history
93
- }, /*#__PURE__*/React.createElement(React.Fragment, null, children))))));
96
+ }, children)))));
94
97
  }
95
98
  AppProvider.propTypes = {
96
99
  // eslint-disable-next-line react/forbid-prop-types
@@ -1 +1 @@
1
- {"version":3,"file":"AppProvider.js","names":["React","useState","PropTypes","Router","OptionalReduxProvider","ErrorBoundary","AppContext","useAppEvent","getAuthenticatedUser","AUTHENTICATED_USER_CHANGED","getConfig","CONFIG_CHANGED","history","getLocale","getMessages","IntlProvider","LOCALE_CHANGED","AppProvider","store","children","config","setConfig","authenticatedUser","setAuthenticatedUser","locale","setLocale","propTypes","object","node","isRequired","defaultProps"],"sources":["../../src/react/AppProvider.jsx"],"sourcesContent":["import React, { useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { Router } from 'react-router-dom';\n\nimport OptionalReduxProvider from './OptionalReduxProvider';\n\nimport ErrorBoundary from './ErrorBoundary';\nimport AppContext from './AppContext';\nimport { useAppEvent } from './hooks';\nimport { getAuthenticatedUser, AUTHENTICATED_USER_CHANGED } from '../auth';\nimport { getConfig } from '../config';\nimport { CONFIG_CHANGED } from '../constants';\nimport { history } from '../initialize';\nimport {\n getLocale,\n getMessages,\n IntlProvider,\n LOCALE_CHANGED,\n} from '../i18n';\n\n/**\n * A wrapper component for React-based micro-frontends to initialize a number of common data/\n * context providers.\n *\n * ```\n * subscribe(APP_READY, () => {\n * ReactDOM.render(\n * <AppProvider>\n * <HelloWorld />\n * </AppProvider>\n * )\n * });\n * ```\n *\n * This will provide the following to HelloWorld:\n * - An error boundary as described above.\n * - An `AppContext` provider for React context data.\n * - IntlProvider for @edx/frontend-i18n internationalization\n * - Optionally a redux `Provider`. Will only be included if a `store` property is passed to\n * `AppProvider`.\n * - A `Router` for react-router.\n *\n * @param {Object} props\n * @param {Object} [props.store] A redux store.\n * @memberof module:React\n */\nexport default function AppProvider({ store, children }) {\n const [config, setConfig] = useState(getConfig());\n const [authenticatedUser, setAuthenticatedUser] = useState(getAuthenticatedUser());\n const [locale, setLocale] = useState(getLocale());\n\n useAppEvent(AUTHENTICATED_USER_CHANGED, () => {\n setAuthenticatedUser(getAuthenticatedUser());\n });\n\n useAppEvent(CONFIG_CHANGED, () => {\n setConfig(getConfig());\n });\n\n useAppEvent(LOCALE_CHANGED, () => {\n setLocale(getLocale());\n });\n\n return (\n <IntlProvider locale={locale} messages={getMessages()}>\n <ErrorBoundary>\n <AppContext.Provider\n value={{ authenticatedUser, config, locale }}\n >\n <OptionalReduxProvider store={store}>\n <Router history={history}>\n <>{children}</>\n </Router>\n </OptionalReduxProvider>\n </AppContext.Provider>\n </ErrorBoundary>\n </IntlProvider>\n );\n}\n\nAppProvider.propTypes = {\n // eslint-disable-next-line react/forbid-prop-types\n store: PropTypes.object,\n children: PropTypes.node.isRequired,\n};\n\nAppProvider.defaultProps = {\n store: null,\n};\n"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,KAAP,IAAgBC,QAAhB,QAAgC,OAAhC;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,MAAT,QAAuB,kBAAvB;AAEA,OAAOC,qBAAP,MAAkC,yBAAlC;AAEA,OAAOC,aAAP,MAA0B,iBAA1B;AACA,OAAOC,UAAP,MAAuB,cAAvB;AACA,SAASC,WAAT,QAA4B,SAA5B;AACA,SAASC,oBAAT,EAA+BC,0BAA/B,QAAiE,SAAjE;AACA,SAASC,SAAT,QAA0B,WAA1B;AACA,SAASC,cAAT,QAA+B,cAA/B;AACA,SAASC,OAAT,QAAwB,eAAxB;AACA,SACEC,SADF,EAEEC,WAFF,EAGEC,YAHF,EAIEC,cAJF,QAKO,SALP;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,eAAe,SAASC,WAAT,OAA0C;EAAA,IAAnBC,KAAmB,QAAnBA,KAAmB;EAAA,IAAZC,QAAY,QAAZA,QAAY;;EACvD,gBAA4BlB,QAAQ,CAACS,SAAS,EAAV,CAApC;EAAA;EAAA,IAAOU,MAAP;EAAA,IAAeC,SAAf;;EACA,iBAAkDpB,QAAQ,CAACO,oBAAoB,EAArB,CAA1D;EAAA;EAAA,IAAOc,iBAAP;EAAA,IAA0BC,oBAA1B;;EACA,iBAA4BtB,QAAQ,CAACY,SAAS,EAAV,CAApC;EAAA;EAAA,IAAOW,MAAP;EAAA,IAAeC,SAAf;;EAEAlB,WAAW,CAACE,0BAAD,EAA6B,YAAM;IAC5Cc,oBAAoB,CAACf,oBAAoB,EAArB,CAApB;EACD,CAFU,CAAX;EAIAD,WAAW,CAACI,cAAD,EAAiB,YAAM;IAChCU,SAAS,CAACX,SAAS,EAAV,CAAT;EACD,CAFU,CAAX;EAIAH,WAAW,CAACS,cAAD,EAAiB,YAAM;IAChCS,SAAS,CAACZ,SAAS,EAAV,CAAT;EACD,CAFU,CAAX;EAIA,oBACE,oBAAC,YAAD;IAAc,MAAM,EAAEW,MAAtB;IAA8B,QAAQ,EAAEV,WAAW;EAAnD,gBACE,oBAAC,aAAD,qBACE,oBAAC,UAAD,CAAY,QAAZ;IACE,KAAK,EAAE;MAAEQ,iBAAiB,EAAjBA,iBAAF;MAAqBF,MAAM,EAANA,MAArB;MAA6BI,MAAM,EAANA;IAA7B;EADT,gBAGE,oBAAC,qBAAD;IAAuB,KAAK,EAAEN;EAA9B,gBACE,oBAAC,MAAD;IAAQ,OAAO,EAAEN;EAAjB,gBACE,0CAAGO,QAAH,CADF,CADF,CAHF,CADF,CADF,CADF;AAeD;AAEDF,WAAW,CAACS,SAAZ,GAAwB;EACtB;EACAR,KAAK,EAAEhB,SAAS,CAACyB,MAFK;EAGtBR,QAAQ,EAAEjB,SAAS,CAAC0B,IAAV,CAAeC;AAHH,CAAxB;AAMAZ,WAAW,CAACa,YAAZ,GAA2B;EACzBZ,KAAK,EAAE;AADkB,CAA3B"}
1
+ {"version":3,"file":"AppProvider.js","names":["React","useState","useMemo","PropTypes","Router","OptionalReduxProvider","ErrorBoundary","AppContext","useAppEvent","getAuthenticatedUser","AUTHENTICATED_USER_CHANGED","getConfig","CONFIG_CHANGED","history","getLocale","getMessages","IntlProvider","LOCALE_CHANGED","AppProvider","store","children","config","setConfig","authenticatedUser","setAuthenticatedUser","locale","setLocale","appContextValue","propTypes","object","node","isRequired","defaultProps"],"sources":["../../src/react/AppProvider.jsx"],"sourcesContent":["import React, { useState, useMemo } from 'react';\nimport PropTypes from 'prop-types';\nimport { Router } from 'react-router-dom';\n\nimport OptionalReduxProvider from './OptionalReduxProvider';\n\nimport ErrorBoundary from './ErrorBoundary';\nimport AppContext from './AppContext';\nimport { useAppEvent } from './hooks';\nimport { getAuthenticatedUser, AUTHENTICATED_USER_CHANGED } from '../auth';\nimport { getConfig } from '../config';\nimport { CONFIG_CHANGED } from '../constants';\nimport { history } from '../initialize';\nimport {\n getLocale,\n getMessages,\n IntlProvider,\n LOCALE_CHANGED,\n} from '../i18n';\n\n/**\n * A wrapper component for React-based micro-frontends to initialize a number of common data/\n * context providers.\n *\n * ```\n * subscribe(APP_READY, () => {\n * ReactDOM.render(\n * <AppProvider>\n * <HelloWorld />\n * </AppProvider>\n * )\n * });\n * ```\n *\n * This will provide the following to HelloWorld:\n * - An error boundary as described above.\n * - An `AppContext` provider for React context data.\n * - IntlProvider for @edx/frontend-i18n internationalization\n * - Optionally a redux `Provider`. Will only be included if a `store` property is passed to\n * `AppProvider`.\n * - A `Router` for react-router.\n *\n * @param {Object} props\n * @param {Object} [props.store] A redux store.\n * @memberof module:React\n */\nexport default function AppProvider({ store, children }) {\n const [config, setConfig] = useState(getConfig());\n const [authenticatedUser, setAuthenticatedUser] = useState(getAuthenticatedUser());\n const [locale, setLocale] = useState(getLocale());\n\n useAppEvent(AUTHENTICATED_USER_CHANGED, () => {\n setAuthenticatedUser(getAuthenticatedUser());\n });\n\n useAppEvent(CONFIG_CHANGED, () => {\n setConfig(getConfig());\n });\n\n useAppEvent(LOCALE_CHANGED, () => {\n setLocale(getLocale());\n });\n\n const appContextValue = useMemo(() => ({ authenticatedUser, config, locale }), [authenticatedUser, config, locale]);\n\n return (\n <IntlProvider locale={locale} messages={getMessages()}>\n <ErrorBoundary>\n <AppContext.Provider\n value={appContextValue}\n >\n <OptionalReduxProvider store={store}>\n <Router history={history}>\n {children}\n </Router>\n </OptionalReduxProvider>\n </AppContext.Provider>\n </ErrorBoundary>\n </IntlProvider>\n );\n}\n\nAppProvider.propTypes = {\n // eslint-disable-next-line react/forbid-prop-types\n store: PropTypes.object,\n children: Prop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AAV,CAAT;EACD,CAFU,CAAX;EAIAH,WAAW,CAACS,cAAD,EAAiB,YAAM;IAChCS,SAAS,CAACZ,SAAS,EAAV,CAAT;EACD,CAFU,CAAX;EAIA,IAAMa,eAAe,GAAGzB,OAAO,CAAC;IAAA,OAAO;MAAEqB,iBAAiB,EAAjBA,iBAAF;MAAqBF,MAAM,EAANA,MAArB;MAA6BI,MAAM,EAANA;IAA7B,CAAP;EAAA,CAAD,EAAgD,CAACF,iBAAD,EAAoBF,MAApB,EAA4BI,MAA5B,CAAhD,CAA/B;EAEA,oBACE,oBAAC,YAAD;IAAc,MAAM,EAAEA,MAAtB;IAA8B,QAAQ,EAAEV,WAAW;EAAnD,gBACE,oBAAC,aAAD,qBACE,oBAAC,UAAD,CAAY,QAAZ;IACE,KAAK,EAAEY;EADT,gBAGE,oBAAC,qBAAD;IAAuB,KAAK,EAAER;EAA9B,gBACE,oBAAC,MAAD;IAAQ,OAAO,EAAEN;EAAjB,GACGO,QADH,CADF,CAHF,CADF,CADF,CADF;AAeD;AAEDF,WAAW,CAACU,SAAZ,GAAwB;EACtB;EACAT,KAAK,EAAEhB,SAAS,CAAC0B,MAFK;EAGtBT,QAAQ,EAAEjB,SAAS,CAAC2B,IAAV,CAAeC;AAHH,CAAxB;AAMAb,WAAW,CAACc,YAAZ,GAA2B;EACzBb,KAAK,EAAE;AADkB,CAA3B"}
@@ -8,7 +8,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
8
8
 
9
9
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
10
10
 
11
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
11
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
12
 
13
13
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
14
14
 
@@ -18,7 +18,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
18
18
 
19
19
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
20
20
 
21
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
21
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
22
22
 
23
23
  import React, { Component } from 'react';
24
24
  import PropTypes from 'prop-types';