@edx/frontend-platform 2.5.0 → 2.6.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/auth/AxiosCsrfTokenService.js +6 -2
- package/auth/AxiosCsrfTokenService.js.map +1 -1
- package/auth/AxiosJwtAuthService.js +10 -6
- package/auth/AxiosJwtAuthService.js.map +1 -1
- package/auth/AxiosJwtTokenService.js +8 -4
- package/auth/AxiosJwtTokenService.js.map +1 -1
- package/auth/LocalForageCache.js +8 -4
- package/auth/LocalForageCache.js.map +1 -1
- package/auth/MockAuthService.js.map +1 -1
- package/auth/interceptors/createCsrfTokenProviderInterceptor.js +6 -2
- package/auth/interceptors/createCsrfTokenProviderInterceptor.js.map +1 -1
- package/auth/interceptors/createJwtTokenProviderInterceptor.js +6 -2
- package/auth/interceptors/createJwtTokenProviderInterceptor.js.map +1 -1
- package/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js +6 -2
- package/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js.map +1 -1
- package/auth/interceptors/createRetryInterceptor.js +9 -5
- package/auth/interceptors/createRetryInterceptor.js.map +1 -1
- package/auth/interface.js +10 -6
- package/auth/interface.js.map +1 -1
- package/config.js +3 -1
- package/config.js.map +1 -1
- package/i18n/countries.js +13 -13
- package/i18n/countries.js.map +1 -1
- package/i18n/injectIntlWithShim.js +3 -3
- package/i18n/languages.js +5 -5
- package/i18n/languages.js.map +1 -1
- package/initialize.js +16 -12
- package/initialize.js.map +1 -1
- package/package.json +4 -4
- package/react/AppProvider.js +10 -7
- package/react/AppProvider.js.map +1 -1
- package/react/ErrorBoundary.js +2 -2
- package/react/ErrorPage.js +49 -64
- package/react/ErrorPage.js.map +1 -1
- package/react/OptionalReduxProvider.js +1 -1
- package/react/OptionalReduxProvider.js.map +1 -1
- package/react/PageRoute.js +2 -1
- package/react/PageRoute.js.map +1 -1
- package/react/hooks.js +1 -1
- package/react/hooks.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createCsrfTokenProviderInterceptor.js","names":["createCsrfTokenProviderInterceptor","options","csrfTokenService","CSRF_TOKEN_API_PATH","shouldSkip","interceptor","axiosRequestConfig","url","getCsrfToken","csrfToken","requestError","Object","create","message","config","Promise","reject","CSRF_HEADER_NAME","headers"],"sources":["../../../src/auth/interceptors/createCsrfTokenProviderInterceptor.js"],"sourcesContent":["const createCsrfTokenProviderInterceptor = (options) => {\n const { csrfTokenService, CSRF_TOKEN_API_PATH, shouldSkip } = options;\n\n // Creating the interceptor inside this closure to\n // maintain reference to the options supplied.\n const interceptor = async (axiosRequestConfig) => {\n if (shouldSkip(axiosRequestConfig)) {\n return axiosRequestConfig;\n }\n const { url } = axiosRequestConfig;\n let csrfToken;\n\n // Important: the job of this interceptor is to get a csrf token and update\n // the original request configuration. Errors thrown getting the csrf token\n // should contain the original request config. This allows other interceptors\n // (namely our retry request interceptor below) to access the original request\n // and handle it appropriately\n try {\n csrfToken = await csrfTokenService.getCsrfToken(url, CSRF_TOKEN_API_PATH);\n } catch (error) {\n const requestError = Object.create(error);\n requestError.message = `[getCsrfToken] ${requestError.message}`;\n // Important: return the original axios request config\n requestError.config = axiosRequestConfig;\n return Promise.reject(requestError);\n }\n\n const CSRF_HEADER_NAME = 'X-CSRFToken';\n // eslint-disable-next-line no-param-reassign\n axiosRequestConfig.headers[CSRF_HEADER_NAME] = csrfToken;\n return axiosRequestConfig;\n };\n\n return interceptor;\n};\n\nexport default createCsrfTokenProviderInterceptor;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"createCsrfTokenProviderInterceptor.js","names":["createCsrfTokenProviderInterceptor","options","csrfTokenService","CSRF_TOKEN_API_PATH","shouldSkip","interceptor","axiosRequestConfig","url","getCsrfToken","csrfToken","requestError","Object","create","message","config","Promise","reject","CSRF_HEADER_NAME","headers"],"sources":["../../../src/auth/interceptors/createCsrfTokenProviderInterceptor.js"],"sourcesContent":["const createCsrfTokenProviderInterceptor = (options) => {\n const { csrfTokenService, CSRF_TOKEN_API_PATH, shouldSkip } = options;\n\n // Creating the interceptor inside this closure to\n // maintain reference to the options supplied.\n const interceptor = async (axiosRequestConfig) => {\n if (shouldSkip(axiosRequestConfig)) {\n return axiosRequestConfig;\n }\n const { url } = axiosRequestConfig;\n let csrfToken;\n\n // Important: the job of this interceptor is to get a csrf token and update\n // the original request configuration. Errors thrown getting the csrf token\n // should contain the original request config. This allows other interceptors\n // (namely our retry request interceptor below) to access the original request\n // and handle it appropriately\n try {\n csrfToken = await csrfTokenService.getCsrfToken(url, CSRF_TOKEN_API_PATH);\n } catch (error) {\n const requestError = Object.create(error);\n requestError.message = `[getCsrfToken] ${requestError.message}`;\n // Important: return the original axios request config\n requestError.config = axiosRequestConfig;\n return Promise.reject(requestError);\n }\n\n const CSRF_HEADER_NAME = 'X-CSRFToken';\n // eslint-disable-next-line no-param-reassign\n axiosRequestConfig.headers[CSRF_HEADER_NAME] = csrfToken;\n return axiosRequestConfig;\n };\n\n return interceptor;\n};\n\nexport default createCsrfTokenProviderInterceptor;\n"],"mappings":";;+CACA,oJ;;;;;;AADA,IAAMA,kCAAkC,GAAG,SAArCA,kCAAqC,CAACC,OAAD,EAAa;EACtD,IAAQC,gBAAR,GAA8DD,OAA9D,CAAQC,gBAAR;EAAA,IAA0BC,mBAA1B,GAA8DF,OAA9D,CAA0BE,mBAA1B;EAAA,IAA+CC,UAA/C,GAA8DH,OAA9D,CAA+CG,UAA/C,CADsD,CAGtD;EACA;;EACA,IAAMC,WAAW;IAAA,sEAAG,iBAAOC,kBAAP;MAAA;MAAA;QAAA;UAAA;YAAA;cAAA,KACdF,UAAU,CAACE,kBAAD,CADI;gBAAA;gBAAA;cAAA;;cAAA,iCAETA,kBAFS;;YAAA;cAIVC,GAJU,GAIFD,kBAJE,CAIVC,GAJU;cAAA;cAAA;cAAA,OAaEL,gBAAgB,CAACM,YAAjB,CAA8BD,GAA9B,EAAmCJ,mBAAnC,CAbF;;YAAA;cAahBM,SAbgB;cAAA;cAAA;;YAAA;cAAA;cAAA;cAeVC,YAfU,GAeKC,MAAM,CAACC,MAAP,aAfL;cAgBhBF,YAAY,CAACG,OAAb,4BAAyCH,YAAY,CAACG,OAAtD,EAhBgB,CAiBhB;;cACAH,YAAY,CAACI,MAAb,GAAsBR,kBAAtB;cAlBgB,iCAmBTS,OAAO,CAACC,MAAR,CAAeN,YAAf,CAnBS;;YAAA;cAsBZO,gBAtBY,GAsBO,aAtBP,EAuBlB;;cACAX,kBAAkB,CAACY,OAAnB,CAA2BD,gBAA3B,IAA+CR,SAA/C;cAxBkB,iCAyBXH,kBAzBW;;YAAA;YAAA;cAAA;UAAA;QAAA;MAAA;IAAA,CAAH;;IAAA,gBAAXD,WAAW;MAAA;IAAA;EAAA,GAAjB;;EA4BA,OAAOA,WAAP;AACD,CAlCD;;AAoCA,eAAeL,kCAAf"}
|
|
@@ -1,3 +1,7 @@
|
|
|
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
|
+
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; }
|
|
4
|
+
|
|
1
5
|
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); } }
|
|
2
6
|
|
|
3
7
|
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); }); }; }
|
|
@@ -8,9 +12,9 @@ var createJwtTokenProviderInterceptor = function createJwtTokenProviderIntercept
|
|
|
8
12
|
// maintain reference to the options supplied.
|
|
9
13
|
|
|
10
14
|
var interceptor = /*#__PURE__*/function () {
|
|
11
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/
|
|
15
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(axiosRequestConfig) {
|
|
12
16
|
var requestError;
|
|
13
|
-
return
|
|
17
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
14
18
|
while (1) {
|
|
15
19
|
switch (_context.prev = _context.next) {
|
|
16
20
|
case 0:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createJwtTokenProviderInterceptor.js","names":["createJwtTokenProviderInterceptor","options","jwtTokenService","shouldSkip","interceptor","axiosRequestConfig","getJwtToken","requestError","Object","create","message","config","Promise","reject","headers","common"],"sources":["../../../src/auth/interceptors/createJwtTokenProviderInterceptor.js"],"sourcesContent":["const createJwtTokenProviderInterceptor = (options) => {\n const {\n jwtTokenService,\n shouldSkip,\n } = options;\n\n // Creating the interceptor inside this closure to\n // maintain reference to the options supplied.\n const interceptor = async (axiosRequestConfig) => {\n if (shouldSkip(axiosRequestConfig)) {\n return axiosRequestConfig;\n }\n\n // Important: the job of this interceptor is to refresh a jwt token and update\n // the original request configuration. Errors thrown from fetching the jwt\n // should contain the original request config. This allows other interceptors\n // (namely our retry request interceptor below) to access the original request\n // and handle it appropriately\n try {\n await jwtTokenService.getJwtToken();\n } catch (error) {\n const requestError = Object.create(error);\n requestError.message = `[getJwtToken] ${requestError.message}`;\n // Important: return the original axios request config\n requestError.config = axiosRequestConfig;\n return Promise.reject(requestError);\n }\n\n // Add the proper headers to tell the server to look for the jwt cookie\n // eslint-disable-next-line no-param-reassign\n axiosRequestConfig.headers.common['USE-JWT-COOKIE'] = true;\n return axiosRequestConfig;\n };\n\n return interceptor;\n};\n\nexport default createJwtTokenProviderInterceptor;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"createJwtTokenProviderInterceptor.js","names":["createJwtTokenProviderInterceptor","options","jwtTokenService","shouldSkip","interceptor","axiosRequestConfig","getJwtToken","requestError","Object","create","message","config","Promise","reject","headers","common"],"sources":["../../../src/auth/interceptors/createJwtTokenProviderInterceptor.js"],"sourcesContent":["const createJwtTokenProviderInterceptor = (options) => {\n const {\n jwtTokenService,\n shouldSkip,\n } = options;\n\n // Creating the interceptor inside this closure to\n // maintain reference to the options supplied.\n const interceptor = async (axiosRequestConfig) => {\n if (shouldSkip(axiosRequestConfig)) {\n return axiosRequestConfig;\n }\n\n // Important: the job of this interceptor is to refresh a jwt token and update\n // the original request configuration. Errors thrown from fetching the jwt\n // should contain the original request config. This allows other interceptors\n // (namely our retry request interceptor below) to access the original request\n // and handle it appropriately\n try {\n await jwtTokenService.getJwtToken();\n } catch (error) {\n const requestError = Object.create(error);\n requestError.message = `[getJwtToken] ${requestError.message}`;\n // Important: return the original axios request config\n requestError.config = axiosRequestConfig;\n return Promise.reject(requestError);\n }\n\n // Add the proper headers to tell the server to look for the jwt cookie\n // eslint-disable-next-line no-param-reassign\n axiosRequestConfig.headers.common['USE-JWT-COOKIE'] = true;\n return axiosRequestConfig;\n };\n\n return interceptor;\n};\n\nexport default createJwtTokenProviderInterceptor;\n"],"mappings":";;+CACA,oJ;;;;;;AADA,IAAMA,iCAAiC,GAAG,SAApCA,iCAAoC,CAACC,OAAD,EAAa;EACrD,IACEC,eADF,GAGID,OAHJ,CACEC,eADF;EAAA,IAEEC,UAFF,GAGIF,OAHJ,CAEEE,UAFF,CADqD,CAMrD;EACA;;EACA,IAAMC,WAAW;IAAA,sEAAG,iBAAOC,kBAAP;MAAA;MAAA;QAAA;UAAA;YAAA;cAAA,KACdF,UAAU,CAACE,kBAAD,CADI;gBAAA;gBAAA;cAAA;;cAAA,iCAETA,kBAFS;;YAAA;cAAA;cAAA;cAAA,OAWVH,eAAe,CAACI,WAAhB,EAXU;;YAAA;cAAA;cAAA;;YAAA;cAAA;cAAA;cAaVC,YAbU,GAaKC,MAAM,CAACC,MAAP,aAbL;cAchBF,YAAY,CAACG,OAAb,2BAAwCH,YAAY,CAACG,OAArD,EAdgB,CAehB;;cACAH,YAAY,CAACI,MAAb,GAAsBN,kBAAtB;cAhBgB,iCAiBTO,OAAO,CAACC,MAAR,CAAeN,YAAf,CAjBS;;YAAA;cAoBlB;cACA;cACAF,kBAAkB,CAACS,OAAnB,CAA2BC,MAA3B,CAAkC,gBAAlC,IAAsD,IAAtD;cAtBkB,iCAuBXV,kBAvBW;;YAAA;YAAA;cAAA;UAAA;QAAA;MAAA;IAAA,CAAH;;IAAA,gBAAXD,WAAW;MAAA;IAAA;EAAA,GAAjB;;EA0BA,OAAOA,WAAP;AACD,CAnCD;;AAqCA,eAAeJ,iCAAf"}
|
|
@@ -1,3 +1,7 @@
|
|
|
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
|
+
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; }
|
|
4
|
+
|
|
1
5
|
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); } }
|
|
2
6
|
|
|
3
7
|
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); }); }; }
|
|
@@ -9,9 +13,9 @@ var createProcessAxiosRequestErrorInterceptor = function createProcessAxiosReque
|
|
|
9
13
|
// maintain reference to the options supplied.
|
|
10
14
|
|
|
11
15
|
var interceptor = /*#__PURE__*/function () {
|
|
12
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/
|
|
16
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(error) {
|
|
13
17
|
var processedError, httpErrorStatus;
|
|
14
|
-
return
|
|
18
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
15
19
|
while (1) {
|
|
16
20
|
switch (_context.prev = _context.next) {
|
|
17
21
|
case 0:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createProcessAxiosRequestErrorInterceptor.js","names":["processAxiosError","createProcessAxiosRequestErrorInterceptor","options","loggingService","interceptor","error","processedError","httpErrorStatus","customAttributes","logInfo","message","Promise","reject"],"sources":["../../../src/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js"],"sourcesContent":["import { processAxiosError } from '../utils';\n\nconst createProcessAxiosRequestErrorInterceptor = (options) => {\n const { loggingService } = options;\n\n // Creating the interceptor inside this closure to\n // maintain reference to the options supplied.\n const interceptor = async (error) => {\n const processedError = processAxiosError(error);\n const { httpErrorStatus } = processedError.customAttributes;\n if (httpErrorStatus === 401 || httpErrorStatus === 403) {\n loggingService.logInfo(processedError.message, processedError.customAttributes);\n }\n return Promise.reject(processedError);\n };\n\n return interceptor;\n};\n\nexport default createProcessAxiosRequestErrorInterceptor;\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"createProcessAxiosRequestErrorInterceptor.js","names":["processAxiosError","createProcessAxiosRequestErrorInterceptor","options","loggingService","interceptor","error","processedError","httpErrorStatus","customAttributes","logInfo","message","Promise","reject"],"sources":["../../../src/auth/interceptors/createProcessAxiosRequestErrorInterceptor.js"],"sourcesContent":["import { processAxiosError } from '../utils';\n\nconst createProcessAxiosRequestErrorInterceptor = (options) => {\n const { loggingService } = options;\n\n // Creating the interceptor inside this closure to\n // maintain reference to the options supplied.\n const interceptor = async (error) => {\n const processedError = processAxiosError(error);\n const { httpErrorStatus } = processedError.customAttributes;\n if (httpErrorStatus === 401 || httpErrorStatus === 403) {\n loggingService.logInfo(processedError.message, processedError.customAttributes);\n }\n return Promise.reject(processedError);\n };\n\n return interceptor;\n};\n\nexport default createProcessAxiosRequestErrorInterceptor;\n"],"mappings":";;+CACA,oJ;;;;;;AADA,SAASA,iBAAT,QAAkC,UAAlC;;AAEA,IAAMC,yCAAyC,GAAG,SAA5CA,yCAA4C,CAACC,OAAD,EAAa;EAC7D,IAAQC,cAAR,GAA2BD,OAA3B,CAAQC,cAAR,CAD6D,CAG7D;EACA;;EACA,IAAMC,WAAW;IAAA,sEAAG,iBAAOC,KAAP;MAAA;MAAA;QAAA;UAAA;YAAA;cACZC,cADY,GACKN,iBAAiB,CAACK,KAAD,CADtB;cAEVE,eAFU,GAEUD,cAAc,CAACE,gBAFzB,CAEVD,eAFU;;cAGlB,IAAIA,eAAe,KAAK,GAApB,IAA2BA,eAAe,KAAK,GAAnD,EAAwD;gBACtDJ,cAAc,CAACM,OAAf,CAAuBH,cAAc,CAACI,OAAtC,EAA+CJ,cAAc,CAACE,gBAA9D;cACD;;cALiB,iCAMXG,OAAO,CAACC,MAAR,CAAeN,cAAf,CANW;;YAAA;YAAA;cAAA;UAAA;QAAA;MAAA;IAAA,CAAH;;IAAA,gBAAXF,WAAW;MAAA;IAAA;EAAA,GAAjB;;EASA,OAAOA,WAAP;AACD,CAfD;;AAiBA,eAAeH,yCAAf"}
|
|
@@ -1,3 +1,7 @@
|
|
|
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
|
+
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; }
|
|
4
|
+
|
|
1
5
|
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); } }
|
|
2
6
|
|
|
3
7
|
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); }); }; }
|
|
@@ -31,10 +35,10 @@ var createRetryInterceptor = function createRetryInterceptor() {
|
|
|
31
35
|
defaultMaxRetries = _options$defaultMaxRe === void 0 ? 2 : _options$defaultMaxRe;
|
|
32
36
|
|
|
33
37
|
var interceptor = /*#__PURE__*/function () {
|
|
34
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/
|
|
38
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(error) {
|
|
35
39
|
var config, _config$maxRetries, maxRetries, retryRequest;
|
|
36
40
|
|
|
37
|
-
return
|
|
41
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
38
42
|
while (1) {
|
|
39
43
|
switch (_context2.prev = _context2.next) {
|
|
40
44
|
case 0:
|
|
@@ -59,9 +63,9 @@ var createRetryInterceptor = function createRetryInterceptor() {
|
|
|
59
63
|
_config$maxRetries = config.maxRetries, maxRetries = _config$maxRetries === void 0 ? defaultMaxRetries : _config$maxRetries;
|
|
60
64
|
|
|
61
65
|
retryRequest = /*#__PURE__*/function () {
|
|
62
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/
|
|
66
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(nthRetry) {
|
|
63
67
|
var retryResponse, backoffDelay;
|
|
64
|
-
return
|
|
68
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
65
69
|
while (1) {
|
|
66
70
|
switch (_context.prev = _context.next) {
|
|
67
71
|
case 0:
|
|
@@ -78,7 +82,7 @@ var createRetryInterceptor = function createRetryInterceptor() {
|
|
|
78
82
|
|
|
79
83
|
_context.next = 6;
|
|
80
84
|
return new Promise(function (resolve) {
|
|
81
|
-
|
|
85
|
+
setTimeout(resolve, backoffDelay);
|
|
82
86
|
});
|
|
83
87
|
|
|
84
88
|
case 6:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRetryInterceptor.js","names":["axios","defaultGetBackoffMilliseconds","nthRetry","maximumBackoffMilliseconds","exponentialBackoffSeconds","randomFractionOfASecond","Math","random","backoffSeconds","backoffMilliseconds","round","min","createRetryInterceptor","options","httpClient","create","getBackoffMilliseconds","shouldRetry","error","isRequestError","response","config","defaultMaxRetries","interceptor","Promise","reject","maxRetries","retryRequest","backoffDelay","resolve","setTimeout","request","retryResponse"],"sources":["../../../src/auth/interceptors/createRetryInterceptor.js"],"sourcesContent":["import axios from 'axios';\n\n// This default algorithm is a recreation of what is documented here\n// https://cloud.google.com/storage/docs/exponential-backoff\nconst defaultGetBackoffMilliseconds = (nthRetry, maximumBackoffMilliseconds = 16000) => {\n // Retry at exponential intervals (2, 4, 8, 16...)\n const exponentialBackoffSeconds = 2 ** nthRetry;\n // Add some randomness to avoid sending retries from separate requests all at once\n const randomFractionOfASecond = Math.random();\n const backoffSeconds = exponentialBackoffSeconds + randomFractionOfASecond;\n const backoffMilliseconds = Math.round(backoffSeconds * 1000);\n return Math.min(backoffMilliseconds, maximumBackoffMilliseconds);\n};\n\nconst createRetryInterceptor = (options = {}) => {\n const {\n httpClient = axios.create(),\n getBackoffMilliseconds = defaultGetBackoffMilliseconds,\n // By default only retry outbound request failures (not responses)\n shouldRetry = (error) => {\n const isRequestError = !error.response && error.config;\n return isRequestError;\n },\n // A per-request maxRetries can be specified in request config.\n defaultMaxRetries = 2,\n } = options;\n\n const interceptor = async (error) => {\n const { config } = error;\n\n // If no config exists there was some other error setting up the request\n if (!config) {\n return Promise.reject(error);\n }\n\n if (!shouldRetry(error)) {\n return Promise.reject(error);\n }\n\n const {\n maxRetries = defaultMaxRetries,\n } = config;\n\n const retryRequest = async (nthRetry) => {\n if (nthRetry > maxRetries) {\n // Reject with the original error\n return Promise.reject(error);\n }\n\n let retryResponse;\n\n try {\n const backoffDelay = getBackoffMilliseconds(nthRetry);\n // Delay (wrapped in a promise so we can await the setTimeout)\n await new Promise(resolve => setTimeout(resolve, backoffDelay));\n // Make retry request\n retryResponse = await httpClient.request(config);\n } catch (e) {\n return retryRequest(nthRetry + 1);\n }\n\n return retryResponse;\n };\n\n return retryRequest(1);\n };\n\n return interceptor;\n};\n\nexport default createRetryInterceptor;\nexport { defaultGetBackoffMilliseconds };\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"createRetryInterceptor.js","names":["axios","defaultGetBackoffMilliseconds","nthRetry","maximumBackoffMilliseconds","exponentialBackoffSeconds","randomFractionOfASecond","Math","random","backoffSeconds","backoffMilliseconds","round","min","createRetryInterceptor","options","httpClient","create","getBackoffMilliseconds","shouldRetry","error","isRequestError","response","config","defaultMaxRetries","interceptor","Promise","reject","maxRetries","retryRequest","backoffDelay","resolve","setTimeout","request","retryResponse"],"sources":["../../../src/auth/interceptors/createRetryInterceptor.js"],"sourcesContent":["import axios from 'axios';\n\n// This default algorithm is a recreation of what is documented here\n// https://cloud.google.com/storage/docs/exponential-backoff\nconst defaultGetBackoffMilliseconds = (nthRetry, maximumBackoffMilliseconds = 16000) => {\n // Retry at exponential intervals (2, 4, 8, 16...)\n const exponentialBackoffSeconds = 2 ** nthRetry;\n // Add some randomness to avoid sending retries from separate requests all at once\n const randomFractionOfASecond = Math.random();\n const backoffSeconds = exponentialBackoffSeconds + randomFractionOfASecond;\n const backoffMilliseconds = Math.round(backoffSeconds * 1000);\n return Math.min(backoffMilliseconds, maximumBackoffMilliseconds);\n};\n\nconst createRetryInterceptor = (options = {}) => {\n const {\n httpClient = axios.create(),\n getBackoffMilliseconds = defaultGetBackoffMilliseconds,\n // By default only retry outbound request failures (not responses)\n shouldRetry = (error) => {\n const isRequestError = !error.response && error.config;\n return isRequestError;\n },\n // A per-request maxRetries can be specified in request config.\n defaultMaxRetries = 2,\n } = options;\n\n const interceptor = async (error) => {\n const { config } = error;\n\n // If no config exists there was some other error setting up the request\n if (!config) {\n return Promise.reject(error);\n }\n\n if (!shouldRetry(error)) {\n return Promise.reject(error);\n }\n\n const {\n maxRetries = defaultMaxRetries,\n } = config;\n\n const retryRequest = async (nthRetry) => {\n if (nthRetry > maxRetries) {\n // Reject with the original error\n return Promise.reject(error);\n }\n\n let retryResponse;\n\n try {\n const backoffDelay = getBackoffMilliseconds(nthRetry);\n // Delay (wrapped in a promise so we can await the setTimeout)\n await new Promise(resolve => { setTimeout(resolve, backoffDelay); });\n // Make retry request\n retryResponse = await httpClient.request(config);\n } catch (e) {\n return retryRequest(nthRetry + 1);\n }\n\n return retryResponse;\n };\n\n return retryRequest(1);\n };\n\n return interceptor;\n};\n\nexport default createRetryInterceptor;\nexport { defaultGetBackoffMilliseconds };\n"],"mappings":";;+CACA,oJ;;;;;;AADA,OAAOA,KAAP,MAAkB,OAAlB,C,CAEA;AACA;;AACA,IAAMC,6BAA6B,GAAG,SAAhCA,6BAAgC,CAACC,QAAD,EAAkD;EAAA,IAAvCC,0BAAuC,uEAAV,KAAU;EACtF;EACA,IAAMC,yBAAyB,YAAG,CAAH,EAAQF,QAAR,CAA/B,CAFsF,CAGtF;;EACA,IAAMG,uBAAuB,GAAGC,IAAI,CAACC,MAAL,EAAhC;EACA,IAAMC,cAAc,GAAGJ,yBAAyB,GAAGC,uBAAnD;EACA,IAAMI,mBAAmB,GAAGH,IAAI,CAACI,KAAL,CAAWF,cAAc,GAAG,IAA5B,CAA5B;EACA,OAA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;0BAAA,OAWX,IAAIsB,OAAJ,CAAY,UAAAK,OAAO,EAAI;4BAAEC,UAAU,CAACD,OAAD,EAAUD,YAAV,CAAV;0BAAoC,CAA7D,CAXW;;wBAAA;0BAAA;0BAAA,OAaKd,UAAU,CAACiB,OAAX,CAAmBV,MAAnB,CAbL;;wBAAA;0BAajBW,aAbiB;0BAAA;0BAAA;;wBAAA;0BAAA;0BAAA;0BAAA,iCAeVL,YAAY,CAACzB,QAAQ,GAAG,CAAZ,CAfF;;wBAAA;0BAAA,iCAkBZ8B,aAlBY;;wBAAA;wBAAA;0BAAA;sBAAA;oBAAA;kBAAA;gBAAA,CAhBH;;gBAAA,gBAgBZL,YAhBY;kBAAA;gBAAA;cAAA;;cAAA,kCAqCXA,YAAY,CAAC,CAAD,CArCD;;YAAA;YAAA;cAAA;UAAA;QAAA;MAAA;IAAA,CAAH;;IAAA,gBAAXJ,WAAW;MAAA;IAAA;EAAA,GAAjB;;EAwCA,OAAOA,WAAP;AACD,CAtDD;;AAwDA,eAAeX,sBAAf;AACA,SAASX,6BAAT"}
|
package/auth/interface.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
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
|
+
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; }
|
|
4
|
+
|
|
1
5
|
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); } }
|
|
2
6
|
|
|
3
7
|
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); }); }; }
|
|
@@ -233,10 +237,10 @@ export function fetchAuthenticatedUser() {
|
|
|
233
237
|
*/
|
|
234
238
|
|
|
235
239
|
function _fetchAuthenticatedUser() {
|
|
236
|
-
_fetchAuthenticatedUser = _asyncToGenerator( /*#__PURE__*/
|
|
240
|
+
_fetchAuthenticatedUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
237
241
|
var options,
|
|
238
242
|
_args = arguments;
|
|
239
|
-
return
|
|
243
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
240
244
|
while (1) {
|
|
241
245
|
switch (_context.prev = _context.next) {
|
|
242
246
|
case 0:
|
|
@@ -271,8 +275,8 @@ export function ensureAuthenticatedUser(_x) {
|
|
|
271
275
|
*/
|
|
272
276
|
|
|
273
277
|
function _ensureAuthenticatedUser() {
|
|
274
|
-
_ensureAuthenticatedUser = _asyncToGenerator( /*#__PURE__*/
|
|
275
|
-
return
|
|
278
|
+
_ensureAuthenticatedUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(redirectUrl) {
|
|
279
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
276
280
|
while (1) {
|
|
277
281
|
switch (_context2.prev = _context2.next) {
|
|
278
282
|
case 0:
|
|
@@ -349,8 +353,8 @@ export function hydrateAuthenticatedUser() {
|
|
|
349
353
|
*/
|
|
350
354
|
|
|
351
355
|
function _hydrateAuthenticatedUser() {
|
|
352
|
-
_hydrateAuthenticatedUser = _asyncToGenerator( /*#__PURE__*/
|
|
353
|
-
return
|
|
356
|
+
_hydrateAuthenticatedUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
357
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
354
358
|
while (1) {
|
|
355
359
|
switch (_context3.prev = _context3.next) {
|
|
356
360
|
case 0:
|
package/auth/interface.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interface.js","names":["PropTypes","publish","AUTHENTICATED_USER_TOPIC","AUTHENTICATED_USER_CHANGED","optionsShape","config","shape","BASE_URL","string","isRequired","LMS_BASE_URL","LOGIN_URL","LOGOUT_URL","REFRESH_ACCESS_TOKEN_ENDPOINT","ACCESS_TOKEN_COOKIE_NAME","CSRF_TOKEN_API_PATH","loggingService","logError","func","logInfo","serviceShape","getAuthenticatedHttpClient","getHttpClient","getLoginRedirectUrl","redirectToLogin","getLogoutRedirectUrl","redirectToLogout","getAuthenticatedUser","setAuthenticatedUser","fetchAuthenticatedUser","ensureAuthenticatedUser","hydrateAuthenticatedUser","service","configure","AuthService","options","checkPropTypes","getAuthService","Error","resetAuthService","redirectUrl","authUser"],"sources":["../../src/auth/interface.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform/auth**\n *\n * Simplifies the process of making authenticated API requests to backend edX services by providing\n * common authN/authZ client code that enables the login/logout flow and handles ensuring the\n * presence of a valid [JWT cookie](https://github.com/edx/edx-platform/blob/master/openedx/core/djangoapps/oauth_dispatch/docs/decisions/0009-jwt-in-session-cookie.rst).\n *\n * The `initialize` function performs much of the auth configuration for you. If, however, you're\n * not using the `initialize` function, an authenticated API client can be created via:\n *\n * ```\n * import {\n * configure,\n * fetchAuthenticatedUser,\n * getAuthenticatedHttpClient\n * } from '@edx/frontend-platform/auth';\n * import { getConfig } from '@edx/frontend-platform';\n * import { getLoggingService } from '@edx/frontend-platform/logging';\n *\n * configure({\n * loggingService: getLoggingService(),\n * config: getConfig(),\n * });\n *\n * const authenticatedUser = await fetchAuthenticatedUser(); // validates and decodes JWT token\n * const authenticatedHttpClient = getAuthenticatedHttpClient();\n * const response = await getAuthenticatedHttpClient().get(`https://example.com/api/user/data/${authenticatedUser.username}`); // fetching from an authenticated API using user data\n * ```\n *\n * As shown in this example, auth depends on the configuration document and logging.\n *\n * NOTE: The documentation for AxiosJwtAuthService is nearly the same as that for the top-level\n * auth interface, except that it contains some Axios-specific details.\n *\n * @module Auth\n */\nimport PropTypes from 'prop-types';\nimport { publish } from '../pubSub';\n\n/**\n * @constant\n * @private\n */\nexport const AUTHENTICATED_USER_TOPIC = 'AUTHENTICATED_USER';\n\n/**\n * Published when the authenticated user data changes. This can happen when the authentication\n * service determines that the user is authenticated or anonymous, as well as when we fetch\n * additional user account data if the `hydrateAuthenticatedUser` flag has been set in the\n * `initialize` function.\n *\n * @event\n * @see {@link module:Initialization~initialize}\n */\nexport const AUTHENTICATED_USER_CHANGED = `${AUTHENTICATED_USER_TOPIC}.CHANGED`;\n\nconst optionsShape = {\n config: PropTypes.shape({\n BASE_URL: PropTypes.string.isRequired,\n LMS_BASE_URL: PropTypes.string.isRequired,\n LOGIN_URL: PropTypes.string.isRequired,\n LOGOUT_URL: PropTypes.string.isRequired,\n REFRESH_ACCESS_TOKEN_ENDPOINT: PropTypes.string.isRequired,\n ACCESS_TOKEN_COOKIE_NAME: PropTypes.string.isRequired,\n CSRF_TOKEN_API_PATH: PropTypes.string.isRequired,\n }).isRequired,\n loggingService: PropTypes.shape({\n logError: PropTypes.func.isRequired,\n logInfo: PropTypes.func.isRequired,\n }).isRequired,\n};\n\nconst serviceShape = {\n getAuthenticatedHttpClient: PropTypes.func.isRequired,\n getHttpClient: PropTypes.func.isRequired,\n getLoginRedirectUrl: PropTypes.func.isRequired,\n redirectToLogin: PropTypes.func.isRequired,\n getLogoutRedirectUrl: PropTypes.func.isRequired,\n redirectToLogout: PropTypes.func.isRequired,\n getAuthenticatedUser: PropTypes.func.isRequired,\n setAuthenticatedUser: PropTypes.func.isRequired,\n fetchAuthenticatedUser: PropTypes.func.isRequired,\n ensureAuthenticatedUser: PropTypes.func.isRequired,\n hydrateAuthenticatedUser: PropTypes.func.isRequired,\n};\n\nlet service;\n\n/**\n *\n * @param {class} AuthService\n * @param {*} options\n * @returns {AuthService}\n */\nexport function configure(AuthService, options) {\n PropTypes.checkPropTypes(optionsShape, options, 'property', 'Auth');\n service = new AuthService(options);\n PropTypes.checkPropTypes(serviceShape, service, 'property', 'AuthService');\n return service;\n}\n\n/**\n *\n *\n * @returns {AuthService}\n */\nexport function getAuthService() {\n if (!service) {\n throw Error('You must first configure the auth service.');\n }\n\n return service;\n}\n\n/**\n *\n */\nexport function resetAuthService() {\n service = null;\n}\n\n/**\n * Gets the authenticated HTTP client for the service.\n *\n * @param {Object} [options] Optional options for how to configure the authenticated HTTP client\n * @param {boolean} [options.useCache] Whether to use front end caching for all requests made with the returned client\n *\n * @returns {HttpClient}\n */\nexport function getAuthenticatedHttpClient(options = {}) {\n return service.getAuthenticatedHttpClient(options);\n}\n\n/**\n * Gets the unauthenticated HTTP client for the service.\n *\n * @param {Object} [options] Optional options for how to configure the authenticated HTTP client\n * @param {boolean} [options.useCache] Whether to use front end caching for all requests made with the returned client\n *\n * @returns {HttpClient}\n */\nexport function getHttpClient(options = {}) {\n return service.getHttpClient(options);\n}\n\n/**\n * Builds a URL to the login page with a post-login redirect URL attached as a query parameter.\n *\n * ```\n * const url = getLoginRedirectUrl('http://localhost/mypage');\n * console.log(url); // http://localhost/login?next=http%3A%2F%2Flocalhost%2Fmypage\n * ```\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging in.\n */\nexport function getLoginRedirectUrl(redirectUrl) {\n return service.getLoginRedirectUrl(redirectUrl);\n}\n\n/**\n * Redirects the user to the login page.\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging in.\n */\nexport function redirectToLogin(redirectUrl) {\n return service.redirectToLogin(redirectUrl);\n}\n\n/**\n * Builds a URL to the logout page with a post-logout redirect URL attached as a query parameter.\n *\n * ```\n * const url = getLogoutRedirectUrl('http://localhost/mypage');\n * console.log(url); // http://localhost/logout?redirect_url=http%3A%2F%2Flocalhost%2Fmypage\n * ```\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging out.\n */\nexport function getLogoutRedirectUrl(redirectUrl) {\n return service.getLogoutRedirectUrl(redirectUrl);\n}\n\n/**\n * Redirects the user to the logout page.\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging out.\n */\nexport function redirectToLogout(redirectUrl) {\n return service.redirectToLogout(redirectUrl);\n}\n\n/**\n * If it exists, returns the user data representing the currently authenticated user. If the\n * user is anonymous, returns null.\n *\n * @returns {UserData|null}\n */\nexport function getAuthenticatedUser() {\n return service.getAuthenticatedUser();\n}\n\n/**\n * Sets the authenticated user to the provided value.\n *\n * @param {UserData} authUser\n * @emits AUTHENTICATED_USER_CHANGED\n */\nexport function setAuthenticatedUser(authUser) {\n service.setAuthenticatedUser(authUser);\n publish(AUTHENTICATED_USER_CHANGED);\n}\n\n/**\n * Reads the authenticated user's access token. Resolves to null if the user is\n * unauthenticated.\n *\n * @returns {Promise<UserData>|Promise<null>} Resolves to the user's access token if they are\n * logged in.\n */\nexport async function fetchAuthenticatedUser(options = {}) {\n return service.fetchAuthenticatedUser(options);\n}\n\n/**\n * Ensures a user is authenticated. It will redirect to login when not\n * authenticated.\n *\n * @param {string} [redirectUrl=config.BASE_URL] to return user after login when not\n * authenticated.\n * @returns {Promise<UserData>}\n */\nexport async function ensureAuthenticatedUser(redirectUrl) {\n return service.ensureAuthenticatedUser(redirectUrl);\n}\n\n/**\n * Fetches additional user account information for the authenticated user and merges it into the\n * existing authenticatedUser object, available via getAuthenticatedUser().\n *\n * ```\n * console.log(authenticatedUser); // Will be sparse and only contain basic information.\n * await hydrateAuthenticatedUser()\n * const authenticatedUser = getAuthenticatedUser();\n * console.log(authenticatedUser); // Will contain additional user information\n * ```\n *\n * @emits AUTHENTICATED_USER_CHANGED\n */\nexport async function hydrateAuthenticatedUser() {\n await service.hydrateAuthenticatedUser();\n publish(AUTHENTICATED_USER_CHANGED);\n}\n\n/**\n * @name AuthService\n * @interface\n * @memberof module:Auth\n * @property {function} getAuthenticatedHttpClient\n * @property {function} getHttpClient\n * @property {function} getLoginRedirectUrl\n * @property {function} redirectToLogin\n * @property {function} getLogoutRedirectUrl\n * @property {function} redirectToLogout\n * @property {function} getAuthenticatedUser\n * @property {function} setAuthenticatedUser\n * @property {function} fetchAuthenticatedUser\n * @property {function} ensureAuthenticatedUser\n * @property {function} hydrateAuthenticatedUser\n */\n\n/**\n * A configured axios client. See axios docs for more\n * info https://github.com/axios/axios. All the functions\n * below accept isPublic and isCsrfExempt in the request\n * config options. Setting these to true will prevent this\n * client from attempting to refresh the jwt access token\n * or a csrf token respectively.\n *\n * ```\n * // A public endpoint (no jwt token refresh)\n * apiClient.get('/path/to/endpoint', { isPublic: true });\n * ```\n *\n * ```\n * // A csrf exempt endpoint\n * apiClient.post('/path/to/endpoint', { data }, { isCsrfExempt: true });\n * ```\n *\n * @name HttpClient\n * @interface\n * @memberof module:Auth\n * @property {function} get\n * @property {function} head\n * @property {function} options\n * @property {function} delete (csrf protected)\n * @property {function} post (csrf protected)\n * @property {function} put (csrf protected)\n * @property {function} patch (csrf protected)\n */\n\n/**\n * @name UserData\n * @interface\n * @memberof module:Auth\n * @property {string} userId\n * @property {string} username\n * @property {Array} roles\n * @property {boolean} administrator\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,OAAOA,SAAP,MAAsB,YAAtB;AACA,SAASC,OAAT,QAAwB,WAAxB;AAEA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,wBAAwB,GAAG,oBAAjC;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,0BAA0B,aAAMD,wBAAN,aAAhC;AAEP,IAAME,YAAY,GAAG;EACnBC,MAAM,EAAEL,SAAS,CAACM,KAAV,CAAgB;IACtBC,QAAQ,EAAEP,SAAS,CAACQ,MAAV,CAAiBC,UADL;IAEtBC,YAAY,EAAEV,SAAS,CAACQ,MAAV,CAAiBC,UAFT;IAGtBE,SAAS,EAAEX,SAAS,CAACQ,MAAV,CAAiBC,UAHN;IAItBG,UAAU,EAAEZ,SAAS,CAACQ,MAAV,CAAiBC,UAJP;IAKtBI,6BAA6B,EAAEb,SAAS,CAACQ,MAAV,CAAiBC,UAL1B;IAMtBK,wBAAwB,EAAEd,SAAS,CAACQ,MAAV,CAAiBC,UANrB;IAOtBM,mBAAmB,EAAEf,SAAS,CAACQ,MAAV,CAAiBC;EAPhB,CAAhB,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BAAR,EAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,oBAAT,CAA8Ba,QAA9B,EAAwC;EAC7CT,OAAO,CAACJ,oBAAR,CAA6Ba,QAA7B;EACAxC,OAAO,CAACE,0BAAD,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,gBAAsB0B,sBAAtB;EAAA;AAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;oFAXO;IAAA;IAAA;IAAA;MAAA;QAAA;UAAA;YAAsCM,OAAtC,2DAAgD,EAAhD;YAAA,iCACEH,OAAO,CAACH,sBAAR,CAA+BM,OAA/B,CADF;;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,C;;;;AAYP,gBAAsBL,uBAAtB;EAAA;AAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;qFAhBO,kBAAuCU,WAAvC;IAAA;MAAA;QAAA;UAAA;YAAA,kCACER,OAAO,CAACF,uBAAR,CAAgCU,WAAhC,CADF;;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,C;;;;AAiBP,gBAAsBT,wBAAtB;EAAA;AAAA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;sFA5DO;IAAA;MAAA;QAAA;UAAA;YAAA;YAAA,OACCC,OAAO,CAACD,wBAAR,EADD;;UAAA;YAEL9B,OAAO,CAACE,0BAAD,CAAP;;UAFK;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,C"}
|
|
1
|
+
{"version":3,"file":"interface.js","names":["PropTypes","publish","AUTHENTICATED_USER_TOPIC","AUTHENTICATED_USER_CHANGED","optionsShape","config","shape","BASE_URL","string","isRequired","LMS_BASE_URL","LOGIN_URL","LOGOUT_URL","REFRESH_ACCESS_TOKEN_ENDPOINT","ACCESS_TOKEN_COOKIE_NAME","CSRF_TOKEN_API_PATH","loggingService","logError","func","logInfo","serviceShape","getAuthenticatedHttpClient","getHttpClient","getLoginRedirectUrl","redirectToLogin","getLogoutRedirectUrl","redirectToLogout","getAuthenticatedUser","setAuthenticatedUser","fetchAuthenticatedUser","ensureAuthenticatedUser","hydrateAuthenticatedUser","service","configure","AuthService","options","checkPropTypes","getAuthService","Error","resetAuthService","redirectUrl","authUser"],"sources":["../../src/auth/interface.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform/auth**\n *\n * Simplifies the process of making authenticated API requests to backend edX services by providing\n * common authN/authZ client code that enables the login/logout flow and handles ensuring the\n * presence of a valid [JWT cookie](https://github.com/edx/edx-platform/blob/master/openedx/core/djangoapps/oauth_dispatch/docs/decisions/0009-jwt-in-session-cookie.rst).\n *\n * The `initialize` function performs much of the auth configuration for you. If, however, you're\n * not using the `initialize` function, an authenticated API client can be created via:\n *\n * ```\n * import {\n * configure,\n * fetchAuthenticatedUser,\n * getAuthenticatedHttpClient\n * } from '@edx/frontend-platform/auth';\n * import { getConfig } from '@edx/frontend-platform';\n * import { getLoggingService } from '@edx/frontend-platform/logging';\n *\n * configure({\n * loggingService: getLoggingService(),\n * config: getConfig(),\n * });\n *\n * const authenticatedUser = await fetchAuthenticatedUser(); // validates and decodes JWT token\n * const authenticatedHttpClient = getAuthenticatedHttpClient();\n * const response = await getAuthenticatedHttpClient().get(`https://example.com/api/user/data/${authenticatedUser.username}`); // fetching from an authenticated API using user data\n * ```\n *\n * As shown in this example, auth depends on the configuration document and logging.\n *\n * NOTE: The documentation for AxiosJwtAuthService is nearly the same as that for the top-level\n * auth interface, except that it contains some Axios-specific details.\n *\n * @module Auth\n */\nimport PropTypes from 'prop-types';\nimport { publish } from '../pubSub';\n\n/**\n * @constant\n * @private\n */\nexport const AUTHENTICATED_USER_TOPIC = 'AUTHENTICATED_USER';\n\n/**\n * Published when the authenticated user data changes. This can happen when the authentication\n * service determines that the user is authenticated or anonymous, as well as when we fetch\n * additional user account data if the `hydrateAuthenticatedUser` flag has been set in the\n * `initialize` function.\n *\n * @event\n * @see {@link module:Initialization~initialize}\n */\nexport const AUTHENTICATED_USER_CHANGED = `${AUTHENTICATED_USER_TOPIC}.CHANGED`;\n\nconst optionsShape = {\n config: PropTypes.shape({\n BASE_URL: PropTypes.string.isRequired,\n LMS_BASE_URL: PropTypes.string.isRequired,\n LOGIN_URL: PropTypes.string.isRequired,\n LOGOUT_URL: PropTypes.string.isRequired,\n REFRESH_ACCESS_TOKEN_ENDPOINT: PropTypes.string.isRequired,\n ACCESS_TOKEN_COOKIE_NAME: PropTypes.string.isRequired,\n CSRF_TOKEN_API_PATH: PropTypes.string.isRequired,\n }).isRequired,\n loggingService: PropTypes.shape({\n logError: PropTypes.func.isRequired,\n logInfo: PropTypes.func.isRequired,\n }).isRequired,\n};\n\nconst serviceShape = {\n getAuthenticatedHttpClient: PropTypes.func.isRequired,\n getHttpClient: PropTypes.func.isRequired,\n getLoginRedirectUrl: PropTypes.func.isRequired,\n redirectToLogin: PropTypes.func.isRequired,\n getLogoutRedirectUrl: PropTypes.func.isRequired,\n redirectToLogout: PropTypes.func.isRequired,\n getAuthenticatedUser: PropTypes.func.isRequired,\n setAuthenticatedUser: PropTypes.func.isRequired,\n fetchAuthenticatedUser: PropTypes.func.isRequired,\n ensureAuthenticatedUser: PropTypes.func.isRequired,\n hydrateAuthenticatedUser: PropTypes.func.isRequired,\n};\n\nlet service;\n\n/**\n *\n * @param {class} AuthService\n * @param {*} options\n * @returns {AuthService}\n */\nexport function configure(AuthService, options) {\n PropTypes.checkPropTypes(optionsShape, options, 'property', 'Auth');\n service = new AuthService(options);\n PropTypes.checkPropTypes(serviceShape, service, 'property', 'AuthService');\n return service;\n}\n\n/**\n *\n *\n * @returns {AuthService}\n */\nexport function getAuthService() {\n if (!service) {\n throw Error('You must first configure the auth service.');\n }\n\n return service;\n}\n\n/**\n *\n */\nexport function resetAuthService() {\n service = null;\n}\n\n/**\n * Gets the authenticated HTTP client for the service.\n *\n * @param {Object} [options] Optional options for how to configure the authenticated HTTP client\n * @param {boolean} [options.useCache] Whether to use front end caching for all requests made with the returned client\n *\n * @returns {HttpClient}\n */\nexport function getAuthenticatedHttpClient(options = {}) {\n return service.getAuthenticatedHttpClient(options);\n}\n\n/**\n * Gets the unauthenticated HTTP client for the service.\n *\n * @param {Object} [options] Optional options for how to configure the authenticated HTTP client\n * @param {boolean} [options.useCache] Whether to use front end caching for all requests made with the returned client\n *\n * @returns {HttpClient}\n */\nexport function getHttpClient(options = {}) {\n return service.getHttpClient(options);\n}\n\n/**\n * Builds a URL to the login page with a post-login redirect URL attached as a query parameter.\n *\n * ```\n * const url = getLoginRedirectUrl('http://localhost/mypage');\n * console.log(url); // http://localhost/login?next=http%3A%2F%2Flocalhost%2Fmypage\n * ```\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging in.\n */\nexport function getLoginRedirectUrl(redirectUrl) {\n return service.getLoginRedirectUrl(redirectUrl);\n}\n\n/**\n * Redirects the user to the login page.\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging in.\n */\nexport function redirectToLogin(redirectUrl) {\n return service.redirectToLogin(redirectUrl);\n}\n\n/**\n * Builds a URL to the logout page with a post-logout redirect URL attached as a query parameter.\n *\n * ```\n * const url = getLogoutRedirectUrl('http://localhost/mypage');\n * console.log(url); // http://localhost/logout?redirect_url=http%3A%2F%2Flocalhost%2Fmypage\n * ```\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging out.\n */\nexport function getLogoutRedirectUrl(redirectUrl) {\n return service.getLogoutRedirectUrl(redirectUrl);\n}\n\n/**\n * Redirects the user to the logout page.\n *\n * @param {string} redirectUrl The URL the user should be redirected to after logging out.\n */\nexport function redirectToLogout(redirectUrl) {\n return service.redirectToLogout(redirectUrl);\n}\n\n/**\n * If it exists, returns the user data representing the currently authenticated user. If the\n * user is anonymous, returns null.\n *\n * @returns {UserData|null}\n */\nexport function getAuthenticatedUser() {\n return service.getAuthenticatedUser();\n}\n\n/**\n * Sets the authenticated user to the provided value.\n *\n * @param {UserData} authUser\n * @emits AUTHENTICATED_USER_CHANGED\n */\nexport function setAuthenticatedUser(authUser) {\n service.setAuthenticatedUser(authUser);\n publish(AUTHENTICATED_USER_CHANGED);\n}\n\n/**\n * Reads the authenticated user's access token. Resolves to null if the user is\n * unauthenticated.\n *\n * @returns {Promise<UserData>|Promise<null>} Resolves to the user's access token if they are\n * logged in.\n */\nexport async function fetchAuthenticatedUser(options = {}) {\n return service.fetchAuthenticatedUser(options);\n}\n\n/**\n * Ensures a user is authenticated. It will redirect to login when not\n * authenticated.\n *\n * @param {string} [redirectUrl=config.BASE_URL] to return user after login when not\n * authenticated.\n * @returns {Promise<UserData>}\n */\nexport async function ensureAuthenticatedUser(redirectUrl) {\n return service.ensureAuthenticatedUser(redirectUrl);\n}\n\n/**\n * Fetches additional user account information for the authenticated user and merges it into the\n * existing authenticatedUser object, available via getAuthenticatedUser().\n *\n * ```\n * console.log(authenticatedUser); // Will be sparse and only contain basic information.\n * await hydrateAuthenticatedUser()\n * const authenticatedUser = getAuthenticatedUser();\n * console.log(authenticatedUser); // Will contain additional user information\n * ```\n *\n * @emits AUTHENTICATED_USER_CHANGED\n */\nexport async function hydrateAuthenticatedUser() {\n await service.hydrateAuthenticatedUser();\n publish(AUTHENTICATED_USER_CHANGED);\n}\n\n/**\n * @name AuthService\n * @interface\n * @memberof module:Auth\n * @property {function} getAuthenticatedHttpClient\n * @property {function} getHttpClient\n * @property {function} getLoginRedirectUrl\n * @property {function} redirectToLogin\n * @property {function} getLogoutRedirectUrl\n * @property {function} redirectToLogout\n * @property {function} getAuthenticatedUser\n * @property {function} setAuthenticatedUser\n * @property {function} fetchAuthenticatedUser\n * @property {function} ensureAuthenticatedUser\n * @property {function} hydrateAuthenticatedUser\n */\n\n/**\n * A configured axios client. See axios docs for more\n * info https://github.com/axios/axios. All the functions\n * below accept isPublic and isCsrfExempt in the request\n * config options. Setting these to true will prevent this\n * client from attempting to refresh the jwt access token\n * or a csrf token respectively.\n *\n * ```\n * // A public endpoint (no jwt token refresh)\n * apiClient.get('/path/to/endpoint', { isPublic: true });\n * ```\n *\n * ```\n * // A csrf exempt endpoint\n * apiClient.post('/path/to/endpoint', { data }, { isCsrfExempt: true });\n * ```\n *\n * @name HttpClient\n * @interface\n * @memberof module:Auth\n * @property {function} get\n * @property {function} head\n * @property {function} options\n * @property {function} delete (csrf protected)\n * @property {function} post (csrf protected)\n * @property {function} put (csrf protected)\n * @property {function} patch (csrf protected)\n */\n\n/**\n * @name UserData\n * @interface\n * @memberof module:Auth\n * @property {string} userId\n * @property {string} username\n * @property {Array} roles\n * @property {boolean} administrator\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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAP,MAAsB,YAAtB;AACA,SAASC,OAAT,QAAwB,WAAxB;AAEA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,wBAAwB,GAAG,oBAAjC;AAEP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,IAAMC,0BAA0B,aAAMD,wBAAN,aAAhC;AAEP,IAAME,YAAY,GAAG;EACnBC,MAAM,EAAEL,SAAS,CAACM,KAAV,CAAgB;IACtBC,QAAQ,EAAEP,SAAS,CAACQ,MAAV,CAAiBC,UADL;IAEtBC,YAAY,EAAEV,SAAS,CAACQ,MAAV,CAAiBC,UAFT;IAGtBE,SAAS,EAAEX,SAAS,CAACQ,MAAV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BAAR,CAA6Be,WAA7B,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASd,gBAAT,CAA0Bc,WAA1B,EAAuC;EAC5C,OAAOR,OAAO,CAACN,gBAAR,CAAyBc,WAAzB,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASb,oBAAT,GAAgC;EACrC,OAAOK,OAAO,CAACL,oBAAR,EAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,oBAAT,CAA8Ba,QAA9B,EAAwC;EAC7CT,OAAO,CAACJ,oBAAR,CAA6Ba,QAA7B;EACAxC,OAAO,CAACE,0BAAD,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,gBAAsB0B,sBAAtB;EAAA;AAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;uFAXO;IAAA;IAAA;IAAA;MAAA;QAAA;UAAA;YAAsCM,OAAtC,2DAAgD,EAAhD;YAAA,iCACEH,OAAO,CAACH,sBAAR,CAA+BM,OAA/B,CADF;;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,C;;;;AAYP,gBAAsBL,uBAAtB;EAAA;AAAA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;wFAhBO,kBAAuCU,WAAvC;IAAA;MAAA;QAAA;UAAA;YAAA,kCACER,OAAO,CAACF,uBAAR,CAAgCU,WAAhC,CADF;;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,C;;;;AAiBP,gBAAsBT,wBAAtB;EAAA;AAAA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;yFA5DO;IAAA;MAAA;QAAA;UAAA;YAAA;YAAA,OACCC,OAAO,CAACD,wBAAR,EADD;;UAAA;YAEL9B,OAAO,CAACE,0BAAD,CAAP;;UAFK;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,C"}
|
package/config.js
CHANGED
|
@@ -67,7 +67,8 @@ var config = {
|
|
|
67
67
|
LOGO_WHITE_URL: process.env.LOGO_WHITE_URL,
|
|
68
68
|
FAVICON_URL: process.env.FAVICON_URL,
|
|
69
69
|
MFE_CONFIG_API_URL: process.env.MFE_CONFIG_API_URL,
|
|
70
|
-
APP_ID: process.env.APP_ID
|
|
70
|
+
APP_ID: process.env.APP_ID,
|
|
71
|
+
SUPPORT_URL: process.env.SUPPORT_URL
|
|
71
72
|
};
|
|
72
73
|
/**
|
|
73
74
|
* Getter for the application configuration document. This is synchronous and merely returns a
|
|
@@ -196,5 +197,6 @@ export function ensureConfig(keys) {
|
|
|
196
197
|
* @property {string} FAVICON_URL
|
|
197
198
|
* @property {string} MFE_CONFIG_API_URL
|
|
198
199
|
* @property {string} APP_ID
|
|
200
|
+
* @property {string} SUPPORT_URL
|
|
199
201
|
*/
|
|
200
202
|
//# sourceMappingURL=config.js.map
|
package/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["APP_CONFIG_INITIALIZED","CONFIG_CHANGED","publish","subscribe","ensureDefinedConfig","extractRegex","envVar","trim","RegExp","undefined","ENVIRONMENT","process","env","NODE_ENV","config","ACCESS_TOKEN_COOKIE_NAME","BASE_URL","PUBLIC_PATH","CREDENTIALS_BASE_URL","CSRF_TOKEN_API_PATH","DISCOVERY_API_BASE_URL","PUBLISHER_BASE_URL","ECOMMERCE_BASE_URL","IGNORED_ERROR_REGEX","LANGUAGE_PREFERENCE_COOKIE_NAME","LEARNING_BASE_URL","LMS_BASE_URL","LOGIN_URL","LOGOUT_URL","STUDIO_BASE_URL","MARKETING_SITE_BASE_URL","ORDER_HISTORY_URL","REFRESH_ACCESS_TOKEN_ENDPOINT","SECURE_COOKIES","SEGMENT_KEY","SITE_NAME","USER_INFO_COOKIE_NAME","LOGO_URL","LOGO_TRADEMARK_URL","LOGO_WHITE_URL","FAVICON_URL","MFE_CONFIG_API_URL","APP_ID","getConfig","setConfig","newConfig","mergeConfig","Object","assign","ensureConfig","keys","requester","forEach","key","console","warn"],"sources":["../src/config.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform**\n *\n * The configuration module provides utilities for working with an application's configuration\n * document (ConfigDocument). This module uses `process.env` to import configuration variables\n * from the command-line build process. It can be dynamically extended at run-time using a\n * `config` initialization handler. Please see the Initialization documentation for more\n * information on handlers and initialization phases.\n *\n * ```\n * import { getConfig } from '@edx/frontend-platform';\n *\n * const {\n * BASE_URL,\n * LMS_BASE_URL,\n * LOGIN_URL,\n * LOGIN_URL,\n * REFRESH_ACCESS_TOKEN_ENDPOINT,\n * ACCESS_TOKEN_COOKIE_NAME,\n * CSRF_TOKEN_API_PATH,\n * } = getConfig();\n * ```\n *\n * @module Config\n */\n\nimport { APP_CONFIG_INITIALIZED, CONFIG_CHANGED } from './constants';\n\nimport { publish, subscribe } from './pubSub';\nimport { ensureDefinedConfig } from './utils';\n\nfunction extractRegex(envVar) {\n // Convert the environment variable string to a regex, while guarding\n // against a non-string and an empty/whitespace-only string.\n if (typeof envVar === 'string' && envVar.trim() !== '') {\n return new RegExp(envVar);\n }\n return undefined;\n}\n\nconst ENVIRONMENT = process.env.NODE_ENV;\nlet config = {\n ACCESS_TOKEN_COOKIE_NAME: process.env.ACCESS_TOKEN_COOKIE_NAME,\n BASE_URL: process.env.BASE_URL,\n PUBLIC_PATH: process.env.PUBLIC_PATH || '/',\n CREDENTIALS_BASE_URL: process.env.CREDENTIALS_BASE_URL,\n CSRF_TOKEN_API_PATH: process.env.CSRF_TOKEN_API_PATH,\n DISCOVERY_API_BASE_URL: process.env.DISCOVERY_API_BASE_URL,\n PUBLISHER_BASE_URL: process.env.PUBLISHER_BASE_URL,\n ECOMMERCE_BASE_URL: process.env.ECOMMERCE_BASE_URL,\n ENVIRONMENT,\n IGNORED_ERROR_REGEX: extractRegex(process.env.IGNORED_ERROR_REGEX),\n LANGUAGE_PREFERENCE_COOKIE_NAME: process.env.LANGUAGE_PREFERENCE_COOKIE_NAME,\n LEARNING_BASE_URL: process.env.LEARNING_BASE_URL,\n LMS_BASE_URL: process.env.LMS_BASE_URL,\n LOGIN_URL: process.env.LOGIN_URL,\n LOGOUT_URL: process.env.LOGOUT_URL,\n STUDIO_BASE_URL: process.env.STUDIO_BASE_URL,\n MARKETING_SITE_BASE_URL: process.env.MARKETING_SITE_BASE_URL,\n ORDER_HISTORY_URL: process.env.ORDER_HISTORY_URL,\n REFRESH_ACCESS_TOKEN_ENDPOINT: process.env.REFRESH_ACCESS_TOKEN_ENDPOINT,\n SECURE_COOKIES: ENVIRONMENT !== 'development',\n SEGMENT_KEY: process.env.SEGMENT_KEY,\n SITE_NAME: process.env.SITE_NAME,\n USER_INFO_COOKIE_NAME: process.env.USER_INFO_COOKIE_NAME,\n LOGO_URL: process.env.LOGO_URL,\n LOGO_TRADEMARK_URL: process.env.LOGO_TRADEMARK_URL,\n LOGO_WHITE_URL: process.env.LOGO_WHITE_URL,\n FAVICON_URL: process.env.FAVICON_URL,\n MFE_CONFIG_API_URL: process.env.MFE_CONFIG_API_URL,\n APP_ID: process.env.APP_ID,\n};\n\n/**\n * Getter for the application configuration document. This is synchronous and merely returns a\n * reference to an existing object, and is thus safe to call as often as desired. The document\n * should have the following keys at a minimum:\n *\n * @returns {ConfigDocument}\n */\nexport function getConfig() {\n return config;\n}\n\n/**\n * Replaces the existing ConfigDocument. This is not commonly used, but can be helpful for tests.\n *\n * The supplied config document will be tested with `ensureDefinedConfig` to ensure it does not\n * have any `undefined` keys.\n *\n * @param {ConfigDocument} newConfig\n */\nexport function setConfig(newConfig) {\n ensureDefinedConfig(config, 'config');\n config = newConfig;\n publish(CONFIG_CHANGED);\n}\n\n/**\n * Merges additional configuration values into the ConfigDocument returned by `getConfig`. Will\n * override any values that exist with the same keys.\n *\n * ```\n * mergeConfig({\n * NEW_KEY: 'new value',\n * OTHER_NEW_KEY: 'other new value',\n * });\n *\n * If any of the key values are `undefined`, an error will be logged to 'warn'.\n *\n * @param {Object} newConfig\n */\nexport function mergeConfig(newConfig) {\n ensureDefinedConfig(newConfig, 'ProcessEnvConfigService');\n config = Object.assign(config, newConfig);\n publish(CONFIG_CHANGED);\n}\n\n/**\n * A method allowing application code to indicate that particular ConfigDocument keys are required\n * for them to function. This is useful for diagnosing development/deployment issues, primarily,\n * by surfacing misconfigurations early. For instance, if the build process fails to supply an\n * environment variable on the command-line, it's possible that one of the `process.env` variables\n * will be undefined. Should be used in conjunction with `mergeConfig` for custom `ConfigDocument`\n * properties. Requester is for informational/error reporting purposes only.\n *\n * ```\n * ensureConfig(['LMS_BASE_URL', 'LOGIN_URL'], 'MySpecialComponent');\n *\n * // Will log a warning with:\n * // \"App configuration error: LOGIN_URL is required by MySpecialComponent.\"\n * // if LOGIN_URL is undefined, for example.\n * ```\n *\n * *NOTE*: `ensureConfig` waits until `APP_CONFIG_INITIALIZED` is published to verify the existence\n * of the specified properties. This means that this function is compatible with custom `config`\n * phase handlers responsible for loading additional configuration data in the initialization\n * sequence.\n *\n * @param {Array} keys\n * @param {string} [requester='unspecified application code']\n */\nexport function ensureConfig(keys, requester = 'unspecified application code') {\n subscribe(APP_CONFIG_INITIALIZED, () => {\n keys.forEach((key) => {\n if (config[key] === undefined) {\n // eslint-disable-next-line no-console\n console.warn(`App configuration error: ${key} is required by ${requester}.`);\n }\n });\n });\n}\n\n/**\n * An object describing the current application configuration.\n *\n * The implementation loads this document via `process.env` variables.\n *\n * ```\n * {\n * BASE_URL: process.env.BASE_URL,\n * // ... other vars\n * }\n * ```\n *\n * When using Webpack (i.e., normal usage), the build process is responsible for supplying these\n * variables via command-line environment variables. That means they must be supplied at build\n * time.\n *\n * @name ConfigDocument\n * @memberof module:Config\n * @property {string} ACCESS_TOKEN_COOKIE_NAME\n * @property {string} BASE_URL The URL of the current application.\n * @property {string} CREDENTIALS_BASE_URL\n * @property {string} CSRF_TOKEN_API_PATH\n * @property {string} DISCOVERY_API_BASE_URL\n * @property {string} PUBLISHER_BASE_URL\n * @property {string} ECOMMERCE_BASE_URL\n * @property {string} ENVIRONMENT This is one of: development, production, or test.\n * @property {string} IGNORED_ERROR_REGEX\n * @property {string} LANGUAGE_PREFERENCE_COOKIE_NAME\n * @property {string} LEARNING_BASE_URL\n * @property {string} LMS_BASE_URL\n * @property {string} LOGIN_URL\n * @property {string} LOGOUT_URL\n * @property {string} STUDIO_BASE_URL\n * @property {string} MARKETING_SITE_BASE_URL\n * @property {string} ORDER_HISTORY_URL\n * @property {string} REFRESH_ACCESS_TOKEN_ENDPOINT\n * @property {boolean} SECURE_COOKIES\n * @property {string} SEGMENT_KEY\n * @property {string} SITE_NAME\n * @property {string} USER_INFO_COOKIE_NAME\n * @property {string} LOGO_URL\n * @property {string} LOGO_TRADEMARK_URL\n * @property {string} LOGO_WHITE_URL\n * @property {string} FAVICON_URL\n * @property {string} MFE_CONFIG_API_URL\n * @property {string} APP_ID\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;AAEA,SAASA,sBAAT,EAAiCC,cAAjC,QAAuD,aAAvD;AAEA,SAASC,OAAT,EAAkBC,SAAlB,QAAmC,UAAnC;AACA,SAASC,mBAAT,QAAoC,SAApC;;AAEA,SAASC,YAAT,CAAsBC,MAAtB,EAA8B;EAC5B;EACA;EACA,IAAI,OAAOA,MAAP,KAAkB,QAAlB,IAA8BA,MAAM,CAACC,IAAP,OAAkB,EAApD,EAAwD;IACtD,OAAO,IAAIC,MAAJ,CAAWF,MAAX,CAAP;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T,CAAsBC,IAAtB,EAAwE;EAAA,IAA5CC,SAA4C,uEAAhC,8BAAgC;EAC7EhD,SAAS,CAACH,sBAAD,EAAyB,YAAM;IACtCkD,IAAI,CAACE,OAAL,CAAa,UAACC,GAAD,EAAS;MACpB,IAAIvC,MAAM,CAACuC,GAAD,CAAN,KAAgB5C,SAApB,EAA+B;QAC7B;QACA6C,OAAO,CAACC,IAAR,oCAAyCF,GAAzC,6BAA+DF,SAA/D;MACD;IACF,CALD;EAMD,CAPQ,CAAT;AAQD;AAED;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;AACA"}
|
|
1
|
+
{"version":3,"file":"config.js","names":["APP_CONFIG_INITIALIZED","CONFIG_CHANGED","publish","subscribe","ensureDefinedConfig","extractRegex","envVar","trim","RegExp","undefined","ENVIRONMENT","process","env","NODE_ENV","config","ACCESS_TOKEN_COOKIE_NAME","BASE_URL","PUBLIC_PATH","CREDENTIALS_BASE_URL","CSRF_TOKEN_API_PATH","DISCOVERY_API_BASE_URL","PUBLISHER_BASE_URL","ECOMMERCE_BASE_URL","IGNORED_ERROR_REGEX","LANGUAGE_PREFERENCE_COOKIE_NAME","LEARNING_BASE_URL","LMS_BASE_URL","LOGIN_URL","LOGOUT_URL","STUDIO_BASE_URL","MARKETING_SITE_BASE_URL","ORDER_HISTORY_URL","REFRESH_ACCESS_TOKEN_ENDPOINT","SECURE_COOKIES","SEGMENT_KEY","SITE_NAME","USER_INFO_COOKIE_NAME","LOGO_URL","LOGO_TRADEMARK_URL","LOGO_WHITE_URL","FAVICON_URL","MFE_CONFIG_API_URL","APP_ID","SUPPORT_URL","getConfig","setConfig","newConfig","mergeConfig","Object","assign","ensureConfig","keys","requester","forEach","key","console","warn"],"sources":["../src/config.js"],"sourcesContent":["/**\n * #### Import members from **@edx/frontend-platform**\n *\n * The configuration module provides utilities for working with an application's configuration\n * document (ConfigDocument). This module uses `process.env` to import configuration variables\n * from the command-line build process. It can be dynamically extended at run-time using a\n * `config` initialization handler. Please see the Initialization documentation for more\n * information on handlers and initialization phases.\n *\n * ```\n * import { getConfig } from '@edx/frontend-platform';\n *\n * const {\n * BASE_URL,\n * LMS_BASE_URL,\n * LOGIN_URL,\n * LOGIN_URL,\n * REFRESH_ACCESS_TOKEN_ENDPOINT,\n * ACCESS_TOKEN_COOKIE_NAME,\n * CSRF_TOKEN_API_PATH,\n * } = getConfig();\n * ```\n *\n * @module Config\n */\n\nimport { APP_CONFIG_INITIALIZED, CONFIG_CHANGED } from './constants';\n\nimport { publish, subscribe } from './pubSub';\nimport { ensureDefinedConfig } from './utils';\n\nfunction extractRegex(envVar) {\n // Convert the environment variable string to a regex, while guarding\n // against a non-string and an empty/whitespace-only string.\n if (typeof envVar === 'string' && envVar.trim() !== '') {\n return new RegExp(envVar);\n }\n return undefined;\n}\n\nconst ENVIRONMENT = process.env.NODE_ENV;\nlet config = {\n ACCESS_TOKEN_COOKIE_NAME: process.env.ACCESS_TOKEN_COOKIE_NAME,\n BASE_URL: process.env.BASE_URL,\n PUBLIC_PATH: process.env.PUBLIC_PATH || '/',\n CREDENTIALS_BASE_URL: process.env.CREDENTIALS_BASE_URL,\n CSRF_TOKEN_API_PATH: process.env.CSRF_TOKEN_API_PATH,\n DISCOVERY_API_BASE_URL: process.env.DISCOVERY_API_BASE_URL,\n PUBLISHER_BASE_URL: process.env.PUBLISHER_BASE_URL,\n ECOMMERCE_BASE_URL: process.env.ECOMMERCE_BASE_URL,\n ENVIRONMENT,\n IGNORED_ERROR_REGEX: extractRegex(process.env.IGNORED_ERROR_REGEX),\n LANGUAGE_PREFERENCE_COOKIE_NAME: process.env.LANGUAGE_PREFERENCE_COOKIE_NAME,\n LEARNING_BASE_URL: process.env.LEARNING_BASE_URL,\n LMS_BASE_URL: process.env.LMS_BASE_URL,\n LOGIN_URL: process.env.LOGIN_URL,\n LOGOUT_URL: process.env.LOGOUT_URL,\n STUDIO_BASE_URL: process.env.STUDIO_BASE_URL,\n MARKETING_SITE_BASE_URL: process.env.MARKETING_SITE_BASE_URL,\n ORDER_HISTORY_URL: process.env.ORDER_HISTORY_URL,\n REFRESH_ACCESS_TOKEN_ENDPOINT: process.env.REFRESH_ACCESS_TOKEN_ENDPOINT,\n SECURE_COOKIES: ENVIRONMENT !== 'development',\n SEGMENT_KEY: process.env.SEGMENT_KEY,\n SITE_NAME: process.env.SITE_NAME,\n USER_INFO_COOKIE_NAME: process.env.USER_INFO_COOKIE_NAME,\n LOGO_URL: process.env.LOGO_URL,\n LOGO_TRADEMARK_URL: process.env.LOGO_TRADEMARK_URL,\n LOGO_WHITE_URL: process.env.LOGO_WHITE_URL,\n FAVICON_URL: process.env.FAVICON_URL,\n MFE_CONFIG_API_URL: process.env.MFE_CONFIG_API_URL,\n APP_ID: process.env.APP_ID,\n SUPPORT_URL: process.env.SUPPORT_URL,\n};\n\n/**\n * Getter for the application configuration document. This is synchronous and merely returns a\n * reference to an existing object, and is thus safe to call as often as desired. The document\n * should have the following keys at a minimum:\n *\n * @returns {ConfigDocument}\n */\nexport function getConfig() {\n return config;\n}\n\n/**\n * Replaces the existing ConfigDocument. This is not commonly used, but can be helpful for tests.\n *\n * The supplied config document will be tested with `ensureDefinedConfig` to ensure it does not\n * have any `undefined` keys.\n *\n * @param {ConfigDocument} newConfig\n */\nexport function setConfig(newConfig) {\n ensureDefinedConfig(config, 'config');\n config = newConfig;\n publish(CONFIG_CHANGED);\n}\n\n/**\n * Merges additional configuration values into the ConfigDocument returned by `getConfig`. Will\n * override any values that exist with the same keys.\n *\n * ```\n * mergeConfig({\n * NEW_KEY: 'new value',\n * OTHER_NEW_KEY: 'other new value',\n * });\n *\n * If any of the key values are `undefined`, an error will be logged to 'warn'.\n *\n * @param {Object} newConfig\n */\nexport function mergeConfig(newConfig) {\n ensureDefinedConfig(newConfig, 'ProcessEnvConfigService');\n config = Object.assign(config, newConfig);\n publish(CONFIG_CHANGED);\n}\n\n/**\n * A method allowing application code to indicate that particular ConfigDocument keys are required\n * for them to function. This is useful for diagnosing development/deployment issues, primarily,\n * by surfacing misconfigurations early. For instance, if the build process fails to supply an\n * environment variable on the command-line, it's possible that one of the `process.env` variables\n * will be undefined. Should be used in conjunction with `mergeConfig` for custom `ConfigDocument`\n * properties. Requester is for informational/error reporting purposes only.\n *\n * ```\n * ensureConfig(['LMS_BASE_URL', 'LOGIN_URL'], 'MySpecialComponent');\n *\n * // Will log a warning with:\n * // \"App configuration error: LOGIN_URL is required by MySpecialComponent.\"\n * // if LOGIN_URL is undefined, for example.\n * ```\n *\n * *NOTE*: `ensureConfig` waits until `APP_CONFIG_INITIALIZED` is published to verify the existence\n * of the specified properties. This means that this function is compatible with custom `config`\n * phase handlers responsible for loading additional configuration data in the initialization\n * sequence.\n *\n * @param {Array} keys\n * @param {string} [requester='unspecified application code']\n */\nexport function ensureConfig(keys, requester = 'unspecified application code') {\n subscribe(APP_CONFIG_INITIALIZED, () => {\n keys.forEach((key) => {\n if (config[key] === undefined) {\n // eslint-disable-next-line no-console\n console.warn(`App configuration error: ${key} is required by ${requester}.`);\n }\n });\n });\n}\n\n/**\n * An object describing the current application configuration.\n *\n * The implementation loads this document via `process.env` variables.\n *\n * ```\n * {\n * BASE_URL: process.env.BASE_URL,\n * // ... other vars\n * }\n * ```\n *\n * When using Webpack (i.e., normal usage), the build process is responsible for supplying these\n * variables via command-line environment variables. That means they must be supplied at build\n * time.\n *\n * @name ConfigDocument\n * @memberof module:Config\n * @property {string} ACCESS_TOKEN_COOKIE_NAME\n * @property {string} BASE_URL The URL of the current application.\n * @property {string} CREDENTIALS_BASE_URL\n * @property {string} CSRF_TOKEN_API_PATH\n * @property {string} DISCOVERY_API_BASE_URL\n * @property {string} PUBLISHER_BASE_URL\n * @property {string} ECOMMERCE_BASE_URL\n * @property {string} ENVIRONMENT This is one of: development, production, or test.\n * @property {string} IGNORED_ERROR_REGEX\n * @property {string} LANGUAGE_PREFERENCE_COOKIE_NAME\n * @property {string} LEARNING_BASE_URL\n * @property {string} LMS_BASE_URL\n * @property {string} LOGIN_URL\n * @property {string} LOGOUT_URL\n * @property {string} STUDIO_BASE_URL\n * @property {string} MARKETING_SITE_BASE_URL\n * @property {string} ORDER_HISTORY_URL\n * @property {string} REFRESH_ACCESS_TOKEN_ENDPOINT\n * @property {boolean} SECURE_COOKIES\n * @property {string} SEGMENT_KEY\n * @property {string} SITE_NAME\n * @property {string} USER_INFO_COOKIE_NAME\n * @property {string} LOGO_URL\n * @property {string} LOGO_TRADEMARK_URL\n * @property {string} LOGO_WHITE_URL\n * @property {string} FAVICON_URL\n * @property {string} MFE_CONFIG_API_URL\n * @property {string} APP_ID\n * @property {string} SUPPORT_URL\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;AAEA,SAASA,sBAAT,EAAiCC,cAAjC,QAAuD,aAAvD;AAEA,SAASC,OAAT,EAAkBC,SAAlB,QAAmC,UAAnC;AACA,SAASC,mBAAT,QAAoC,SAApC;;AAEA,SAASC,YAAT,CAAsBC,MAAtB,EAA8B;EAC5B;EACA;EACA,IAAI,OAAOA,MAAP,KAAkB,QAAlB,IAA8BA,MAAM,CAACC,IAAP,OAAkB,EAApD,EAAwD;IACtD,OAAO,IAAIC,MAAJ,CAAWF,MAAX,CAAP;EACD;;EACD,OAAOG,SAAP;AACD;;AAED,IAAMC,WAAW,GAAGC,OAAO,CAACC,GAAR,CAAYC,QAAhC;AACA,IAAIC,MAAM,GAAG;EACXC,wBAAwB,EAAEJ,OAAO,CAACC,GAAR,CAAYG,wBAD3B;EAEXC,QAAQ,EAAEL,OAAO,CAACC,GAAR,CAAYI,Q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MACpB,IAAIxC,MAAM,CAACwC,GAAD,CAAN,KAAgB7C,SAApB,EAA+B;QAC7B;QACA8C,OAAO,CAACC,IAAR,oCAAyCF,GAAzC,6BAA+DF,SAA/D;MACD;IACF,CALD;EAMD,CAPQ,CAAT;AAQD;AAED;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;AACA;AACA"}
|
package/i18n/countries.js
CHANGED
|
@@ -20,20 +20,20 @@ import { getPrimaryLanguageSubtag } from './lib';
|
|
|
20
20
|
* TODO: When we start dynamically loading translations only for the current locale, change this.
|
|
21
21
|
*/
|
|
22
22
|
|
|
23
|
-
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/ar
|
|
24
|
-
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/en
|
|
25
|
-
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/es
|
|
26
|
-
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/fr
|
|
27
|
-
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/zh
|
|
28
|
-
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/ca
|
|
29
|
-
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/he
|
|
30
|
-
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/id
|
|
31
|
-
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/ko
|
|
32
|
-
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/pl
|
|
33
|
-
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/pt
|
|
34
|
-
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/ru
|
|
23
|
+
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/ar'));
|
|
24
|
+
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/en'));
|
|
25
|
+
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/es'));
|
|
26
|
+
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/fr'));
|
|
27
|
+
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/zh'));
|
|
28
|
+
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/ca'));
|
|
29
|
+
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/he'));
|
|
30
|
+
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/id'));
|
|
31
|
+
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/ko'));
|
|
32
|
+
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/pl'));
|
|
33
|
+
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/pt'));
|
|
34
|
+
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/ru')); // COUNTRIES.registerLocale(require('i18n-iso-countries/langs/th.json')); // Doesn't exist in lib.
|
|
35
35
|
|
|
36
|
-
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/uk
|
|
36
|
+
COUNTRIES.registerLocale(require('i18n-iso-countries/langs/uk'));
|
|
37
37
|
/**
|
|
38
38
|
* Provides a lookup table of country IDs to country names for the current locale.
|
|
39
39
|
*
|
package/i18n/countries.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"countries.js","names":["COUNTRIES","langs","countryLangs","getPrimaryLanguageSubtag","registerLocale","require","getCountryMessages","locale","primaryLanguageSubtag","languageCode","includes","getNames","getCountryList","countryMessages","Object","entries","map","code","name"],"sources":["../../src/i18n/countries.js"],"sourcesContent":["import COUNTRIES, { langs as countryLangs } from 'i18n-iso-countries';\n\nimport { getPrimaryLanguageSubtag } from './lib';\n\n/*\n * COUNTRY LISTS\n *\n * Lists of country names localized in supported languages.\n *\n * TODO: When we start dynamically loading translations only for the current locale, change this.\n */\n\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/ar
|
|
1
|
+
{"version":3,"file":"countries.js","names":["COUNTRIES","langs","countryLangs","getPrimaryLanguageSubtag","registerLocale","require","getCountryMessages","locale","primaryLanguageSubtag","languageCode","includes","getNames","getCountryList","countryMessages","Object","entries","map","code","name"],"sources":["../../src/i18n/countries.js"],"sourcesContent":["import COUNTRIES, { langs as countryLangs } from 'i18n-iso-countries';\n\nimport { getPrimaryLanguageSubtag } from './lib';\n\n/*\n * COUNTRY LISTS\n *\n * Lists of country names localized in supported languages.\n *\n * TODO: When we start dynamically loading translations only for the current locale, change this.\n */\n\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/ar'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/en'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/es'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/fr'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/zh'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/ca'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/he'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/id'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/ko'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/pl'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/pt'));\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/ru'));\n// COUNTRIES.registerLocale(require('i18n-iso-countries/langs/th.json')); // Doesn't exist in lib.\nCOUNTRIES.registerLocale(require('i18n-iso-countries/langs/uk'));\n\n/**\n * Provides a lookup table of country IDs to country names for the current locale.\n *\n * @memberof module:I18n\n */\nexport function getCountryMessages(locale) {\n const primaryLanguageSubtag = getPrimaryLanguageSubtag(locale);\n const languageCode = countryLangs().includes(primaryLanguageSubtag) ? primaryLanguageSubtag : 'en';\n\n return COUNTRIES.getNames(languageCode);\n}\n\n/**\n * Provides a list of countries represented as objects of the following shape:\n *\n * {\n * key, // The ID of the country\n * name // The localized name of the country\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 module:I18n\n */\nexport function getCountryList(locale) {\n const countryMessages = getCountryMessages(locale);\n return Object.entries(countryMessages).map(([code, name]) => ({ code, name }));\n}\n"],"mappings":";;;;;;;;;;;;AAAA,OAAOA,SAAP,IAAoBC,KAAK,IAAIC,YAA7B,QAAiD,oBAAjD;AAEA,SAASC,wBAAT,QAAyC,OAAzC;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEAH,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,6BAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,6BAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,6BAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,6BAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,6BAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,6BAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,6BAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,6BAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,6BAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,6BAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,6BAAD,CAAhC;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,6BAAD,CAAhC,E,CACA;;AACAL,SAAS,CAACI,cAAV,CAAyBC,OAAO,CAAC,6BAAD,CAAhC;AAEA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASC,kBAAT,CAA4BC,MAA5B,EAAoC;EACzC,IAAMC,qBAAqB,GAAGL,wBAAwB,CAACI,MAAD,CAAtD;EACA,IAAME,YAAY,GAAGP,YAAY,GAAGQ,QAAf,CAAwBF,qBAAxB,IAAiDA,qBAAjD,GAAyE,IAA9F;EAEA,OAAOR,SAAS,CAACW,QAAV,CAAmBF,YAAnB,CAAP;AACD;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AACA,OAAO,SAASG,cAAT,CAAwBL,MAAxB,EAAgC;EACrC,IAAMM,eAAe,GAAGP,kBAAkB,CAACC,MAAD,CAA1C;EACA,OAAOO,MAAM,CAACC,OAAP,CAAeF,eAAf,EAAgCG,GAAhC,CAAoC;IAAA;IAAA,IAAEC,IAAF;IAAA,IAAQC,IAAR;;IAAA,OAAmB;MAAED,IAAI,EAAJA,IAAF;MAAQC,IAAI,EAAJA;IAAR,CAAnB;EAAA,CAApC,CAAP;AACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
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
2
|
|
|
3
|
-
function _extends() { _extends = Object.assign
|
|
3
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
4
4
|
|
|
5
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
10
10
|
|
|
11
11
|
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); }
|
|
12
12
|
|
|
13
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf
|
|
13
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
14
|
|
|
15
15
|
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); }; }
|
|
16
16
|
|
|
@@ -20,7 +20,7 @@ function _assertThisInitialized(self) { if (self === void 0) { throw new Referen
|
|
|
20
20
|
|
|
21
21
|
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; } }
|
|
22
22
|
|
|
23
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
23
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
24
|
|
|
25
25
|
import React from 'react';
|
|
26
26
|
import { injectIntl } from 'react-intl';
|
package/i18n/languages.js
CHANGED
|
@@ -24,16 +24,16 @@ import { getPrimaryLanguageSubtag } from './lib';
|
|
|
24
24
|
*/
|
|
25
25
|
// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ar.json'));
|
|
26
26
|
|
|
27
|
-
LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/en
|
|
28
|
-
LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/es
|
|
29
|
-
LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/fr
|
|
27
|
+
LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/en'));
|
|
28
|
+
LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/es'));
|
|
29
|
+
LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/fr')); // LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/zh.json'));
|
|
30
30
|
// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ca.json'));
|
|
31
31
|
// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/he.json'));
|
|
32
32
|
// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/id.json'));
|
|
33
33
|
// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ko.json'));
|
|
34
34
|
|
|
35
|
-
LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/pl
|
|
36
|
-
LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/pt
|
|
35
|
+
LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/pl'));
|
|
36
|
+
LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/pt')); // LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/ru.json'));
|
|
37
37
|
// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/th.json'));
|
|
38
38
|
// LANGUAGES.registerLocale(require('@cospired/i18n-iso-languages/langs/uk.json'));
|
|
39
39
|
|