package.cjs.initializers.axiosInitializer.index.js.map Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neeto-commons-frontend Show documentation
Show all versions of neeto-commons-frontend Show documentation
A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.
{"version":3,"file":"index.js","names":["_axios","_interopRequireDefault","require","_i18next","_neetoCist","_Toastr","_ramda","_reactToastify","_useDisplayErrorPage","_axios2","_paramsSerializer","_constants","checkOnlineInterval","requestErrorToasts","shouldNot","skip","_typeof2","shouldShowToastr","response","isNotEmpty","notice","noticeCode","setAuthHeaders","_document$querySelect","axios","defaults","headers","_defineProperty2","HEADERS_KEYS","accept","contentType","xCsrfToken","document","querySelector","getAttribute","createPipe","functions","data","reduce","acc","fn","transformResponseKeysToCamelCase","_response$config$tran","config","transformResponseCase","keysToCamelCase","transformErrorKeysToCamelCase","error","_error$config","_error$response","_ref","_ref$transformRespons","showSuccessToastr","_response$config","_response$config$show","showToastr","requestUrl","url","requestMethod","method","toastIdKey","concat","errorToastId","toast","dismiss","dissoc","matches","showThumbsUpToastr","Toastr","success","icon","className","pullDataFromResponse","_response$config$incl","includeMetadataInResponse","buildSuccessResponseHandler","interceptors","transformCase","push","handleUnauthorizedErrorResponse","_error$response2","_error$config2","status","resetAuthTokens","_ref2","_ref2$redirectOnError","redirectOnError","setTimeout","redirectTo","window","location","pathname","encodeURIComponent","href","isOnline","navigator","onLine","showOfflineToastr","toastId","i18next","t","dismissToastInterval","setInterval","clearInterval","handleNetworkError","startTime","Date","now","elapsedTime","MAXIMUM_OFFLINE_DURATION","showErrorToastr","_error$config3","_error$response3","_ref3","_ref3$showToastr","_ref3$show422ErrorToa","show422ErrorToastr","_ref3$url","_ref3$method","_ref4","message","code","toastrContent","skippedStatusCodes","includes","isCancel","globalProps","railsEnv","getUrlPathName","URL","_unused","handle404ErrorResponse","_error$config4","_error$response4","_ref5","_ref5$show404ErrorPag","show404ErrorPage","_ref5$show403ErrorPag","show403ErrorPage","_error$request","fullUrl","request","responseURL","useErrorDisplayStore","setState","showErrorPage","statusCode","failedApiUrl","failedApiPath","buildErrorResponseHandler","logoutOn401","Promise","reject","bind","cleanupCredentialsForCrossOrigin","hostname","evolve","omit","transformDataToSnakeCase","_request$transformReq","transformRequestCase","serializeKeysToSnakeCase","params","addRequestInterceptors","cleanCredentialsForCrossOrigin","use","addResponseInterceptors","registerIntercepts","initializeAxios","baseURL","authHeaders","paramsSerializer","setParamsSerializer"],"sources":["../../../../src/initializers/axiosInitializer/index.js"],"sourcesContent":["import axios from \"axios\";\nimport i18next from \"i18next\";\nimport {\n isNotEmpty,\n keysToCamelCase,\n matches,\n serializeKeysToSnakeCase,\n} from \"neetocist\";\nimport { Toastr } from \"neetoui\";\nimport { dissoc, evolve, omit } from \"ramda\";\nimport { toast } from \"react-toastify\";\nimport { useErrorDisplayStore } from \"react-utils/useDisplayErrorPage\";\nimport { resetAuthTokens } from \"utils/axios\";\n\nimport setParamsSerializer from \"./paramsSerializer\";\n\nimport { HEADERS_KEYS, MAXIMUM_OFFLINE_DURATION } from \"../constants\";\n\nlet checkOnlineInterval = null;\nlet requestErrorToasts = {};\n\nconst shouldNot = skip => typeof skip === \"object\" || !skip;\n\nconst shouldShowToastr = response =>\n (typeof response === \"string\" && isNotEmpty(response)) ||\n (typeof response === \"object\" && (response?.notice || response?.noticeCode));\n\nconst setAuthHeaders = () => {\n // @ts-ignore\n axios.defaults.headers = {\n [HEADERS_KEYS.accept]: \"application/json\",\n [HEADERS_KEYS.contentType]: \"application/json\",\n [HEADERS_KEYS.xCsrfToken]: document\n .querySelector('[name=\"csrf-token\"]')\n ?.getAttribute(\"content\"),\n };\n};\n\n// pipe function from ramda doesn't accept array of functions.\n// We can't use spread operator too. So this is a workaround.\nconst createPipe = functions => data =>\n functions.reduce((acc, fn) => fn(acc), data);\n\nconst transformResponseKeysToCamelCase = response => {\n const { transformResponseCase = true } = response.config;\n\n if (response.data && transformResponseCase) {\n response.data = keysToCamelCase(response.data);\n }\n\n return response;\n};\n\nconst transformErrorKeysToCamelCase = error => {\n const { transformResponseCase = true } = error.config ?? {};\n\n if (error.response?.data && transformResponseCase) {\n error.response.data = keysToCamelCase(error.response.data);\n }\n\n return error;\n};\n\nconst showSuccessToastr = response => {\n const {\n showToastr = true,\n url: requestUrl,\n method: requestMethod,\n } = response.config;\n if (!showToastr) return response;\n\n const toastIdKey = `${requestMethod}:${requestUrl}`;\n const errorToastId = requestErrorToasts[toastIdKey];\n if (errorToastId) {\n toast.dismiss(errorToastId);\n requestErrorToasts = dissoc(toastIdKey, requestErrorToasts);\n }\n\n if (matches({ showThumbsUpToastr: true }, response.data)) {\n // @ts-ignore\n Toastr.success(\"\", { icon: \"👍\", className: \"w-20\" });\n } else if (matches({ noticeCode: \"thumbs_up\" }, response.data)) {\n // @ts-ignore\n Toastr.success(\"\", { icon: \"👍\", className: \"w-20\" });\n } else if (shouldShowToastr(response.data)) {\n Toastr.success(response.data);\n }\n\n return response;\n};\n\nconst pullDataFromResponse = response => {\n const { includeMetadataInResponse = false } = response.config;\n\n return includeMetadataInResponse ? response : response.data;\n};\n\nconst buildSuccessResponseHandler = skip => {\n const interceptors = [];\n if (!skip?.transformCase) interceptors.push(transformResponseKeysToCamelCase);\n\n if (!skip?.showToastr) interceptors.push(showSuccessToastr);\n\n if (!skip?.pullDataFromResponse) interceptors.push(pullDataFromResponse);\n\n return createPipe(interceptors);\n};\n\nconst handleUnauthorizedErrorResponse = error => {\n if (error.response?.status !== 401) return error;\n\n resetAuthTokens();\n\n const { redirectOnError = true } = error.config ?? {};\n if (redirectOnError) {\n setTimeout(() => {\n const redirectTo =\n window.location.pathname === \"/login\"\n ? \"/login\"\n : `/login?redirect_uri=${encodeURIComponent(window.location.href)}`;\n\n // eslint-disable-next-line xss/no-location-href-assign\n window.location.href = redirectTo;\n }, 300);\n }\n\n return error;\n};\n\nconst isOnline = () => window.navigator.onLine;\n\nconst showOfflineToastr = () => {\n const toastId = Toastr.error(\n i18next.t(\"neetoCommons.toastr.error.networkError\")\n );\n\n if (toastId) {\n const dismissToastInterval = setInterval(() => {\n if (!isOnline()) return;\n\n toast.dismiss(toastId);\n clearInterval(dismissToastInterval);\n checkOnlineInterval = null;\n }, 1000);\n }\n};\n\nconst handleNetworkError = error => {\n if (checkOnlineInterval) return error;\n\n const startTime = Date.now();\n\n checkOnlineInterval = setInterval(() => {\n const elapsedTime = Date.now() - startTime;\n\n if (isOnline()) {\n clearInterval(checkOnlineInterval);\n checkOnlineInterval = null;\n } else if (elapsedTime >= MAXIMUM_OFFLINE_DURATION) {\n clearInterval(checkOnlineInterval);\n showOfflineToastr();\n }\n }, 1000);\n\n return error;\n};\n\nconst showErrorToastr = error => {\n const {\n showToastr = true,\n show422ErrorToastr = true,\n url: requestUrl = \"\",\n method: requestMethod = \"\",\n } = error.config ?? {};\n const { status } = error.response ?? {};\n\n if (!showToastr) return error;\n\n if (error.message === \"Network Error\") return handleNetworkError(error);\n\n if (error.code === \"ECONNABORTED\") {\n return error;\n }\n\n let shouldShowToastr = false,\n toastrContent = error;\n\n const skippedStatusCodes = [403, 404, 520, 422];\n if (!skippedStatusCodes.includes(status) && !axios.isCancel(error)) {\n // we already display a page in case of 403 & 404 and we don't want to show a toastr for cancelled requests.\n // We handle cloudflare error differently for production and other environments.\n shouldShowToastr = true;\n }\n\n if (status === 422 && show422ErrorToastr) shouldShowToastr = true;\n\n if (status === 520) {\n shouldShowToastr = true;\n if (globalProps.railsEnv === \"production\") {\n toastrContent = i18next.t(\"generic.error\");\n }\n }\n\n const toastIdKey = `${requestMethod}:${requestUrl}`;\n const errorToastId = requestErrorToasts[toastIdKey];\n if (errorToastId) toast.dismiss(errorToastId);\n\n if (shouldShowToastr) {\n if (errorToastId) {\n // if there's an existing toastr with the same message, the onClose callback in the neetoUI which\n // removes the toastr from the unique list will be fired only after the toast is completely removed\n // from the UI. If there's no delay, the new toastr will be considered as duplicate and ignored.\n setTimeout(() => {\n requestErrorToasts[toastIdKey] = Toastr.error(toastrContent);\n }, 1200);\n } else requestErrorToasts[toastIdKey] = Toastr.error(toastrContent);\n }\n\n return error;\n};\n\nconst getUrlPathName = url => {\n try {\n return new URL(url).pathname;\n } catch {\n return url;\n }\n};\n\nconst handle404ErrorResponse = error => {\n const { show404ErrorPage = true, show403ErrorPage = true } =\n error.config ?? {};\n\n const status = error.response?.status;\n if (\n (status === 404 && show404ErrorPage) ||\n (status === 403 && show403ErrorPage)\n ) {\n const fullUrl = error.request?.responseURL || error.config.url;\n useErrorDisplayStore.setState({\n showErrorPage: true,\n statusCode: status,\n failedApiUrl: fullUrl,\n failedApiPath: getUrlPathName(fullUrl),\n });\n }\n\n return error;\n};\n\nconst buildErrorResponseHandler = skip => {\n const interceptors = [];\n if (!skip?.transformCase) interceptors.push(transformErrorKeysToCamelCase);\n\n if (!skip?.show404ErrorPage) interceptors.push(handle404ErrorResponse);\n\n if (!skip?.logoutOn401) interceptors.push(handleUnauthorizedErrorResponse);\n\n if (!skip?.showToastr) interceptors.push(showErrorToastr);\n\n interceptors.push(Promise.reject.bind(Promise));\n\n return createPipe(interceptors);\n};\n\nconst cleanupCredentialsForCrossOrigin = request => {\n if (!request.url.includes(\"://\")) return request;\n\n if (request.url.includes(window.location.hostname)) return request;\n\n return evolve({ headers: omit([HEADERS_KEYS.xCsrfToken]) })(request);\n};\n\nconst transformDataToSnakeCase = request => {\n const { transformRequestCase = true } = request;\n\n if (!transformRequestCase) return request;\n\n return evolve(\n { data: serializeKeysToSnakeCase, params: serializeKeysToSnakeCase },\n request\n );\n};\n\nconst addRequestInterceptors = skip => {\n if (!skip?.cleanCredentialsForCrossOrigin) {\n axios.interceptors.request.use(cleanupCredentialsForCrossOrigin);\n }\n\n if (!skip?.transformCase) {\n axios.interceptors.request.use(transformDataToSnakeCase);\n }\n};\n\nconst addResponseInterceptors = skip => {\n axios.interceptors.response.use(\n buildSuccessResponseHandler(skip),\n buildErrorResponseHandler(skip)\n );\n};\n\nconst registerIntercepts = skip => {\n if (shouldNot(skip?.request)) addRequestInterceptors(skip?.request);\n\n if (shouldNot(skip?.response)) addResponseInterceptors(skip?.response);\n};\n\nexport default function initializeAxios(skip) {\n if (!skip?.baseURL) axios.defaults.baseURL = \"/\";\n\n if (!skip?.authHeaders) setAuthHeaders();\n\n if (!skip?.paramsSerializer) setParamsSerializer();\n\n if (shouldNot(skip?.interceptors)) registerIntercepts(skip?.interceptors);\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AAKmB,IAAAG,OAAA,GAAAJ,sBAAA,CAAAC,OAAA;AAEnB,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,oBAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AAEA,IAAAQ,iBAAA,GAAAT,sBAAA,CAAAC,OAAA;AAEA,IAAAS,UAAA,GAAAT,OAAA;AAEA,IAAIU,mBAAmB,GAAG,IAAI;AAC9B,IAAIC,kBAAkB,GAAG,CAAC,CAAC;AAE3B,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAGC,IAAI;EAAA,OAAI,IAAAC,QAAA,aAAOD,IAAI,MAAK,QAAQ,IAAI,CAACA,IAAI;AAAA;AAE3D,IAAME,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAGC,QAAQ;EAAA,OAC9B,OAAOA,QAAQ,KAAK,QAAQ,IAAI,IAAAC,qBAAU,EAACD,QAAQ,CAAC,IACpD,IAAAF,QAAA,aAAOE,QAAQ,MAAK,QAAQ,KAAK,CAAAA,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEE,MAAM,MAAIF,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEG,UAAU,EAAE;AAAA;AAE9E,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAA,EAAS;EAAA,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