@bigbinary/neeto-commons-frontend 4.13.165 → 4.13.166-beta1

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/dist/.ready CHANGED
@@ -1 +1 @@
1
- Built at 2026-10-08T10:35:55.480Z
1
+ Built at 2026-10-09T18:57:20.915Z
@@ -130,8 +130,6 @@ var handleUnauthorizedErrorResponse = function handleUnauthorizedErrorResponse(e
130
130
  if (redirectOnError) {
131
131
  setTimeout(function () {
132
132
  var redirectTo = window.location.pathname === "/login" ? "/login" : "/login?redirect_uri=".concat(encodeURIComponent(window.location.href));
133
-
134
- // eslint-disable-next-line xss/no-location-href-assign
135
133
  window.location.href = redirectTo;
136
134
  }, 300);
137
135
  }
@@ -173,6 +171,8 @@ var showErrorToastr = function showErrorToastr(error) {
173
171
  showToastr = _ref3$showToastr === void 0 ? true : _ref3$showToastr,
174
172
  _ref3$show422ErrorToa = _ref3.show422ErrorToastr,
175
173
  show422ErrorToastr = _ref3$show422ErrorToa === void 0 ? true : _ref3$show422ErrorToa,
174
+ _ref3$show429ErrorPag = _ref3.show429ErrorPage,
175
+ show429ErrorPage = _ref3$show429ErrorPag === void 0 ? true : _ref3$show429ErrorPag,
176
176
  _ref3$url = _ref3.url,
177
177
  requestUrl = _ref3$url === void 0 ? "" : _ref3$url,
178
178
  _ref3$method = _ref3.method,
@@ -193,6 +193,7 @@ var showErrorToastr = function showErrorToastr(error) {
193
193
  shouldShowToastr = true;
194
194
  }
195
195
  if (status === 422 && show422ErrorToastr) shouldShowToastr = true;
196
+ if (status === 429 && show429ErrorPage) shouldShowToastr = false;
196
197
  if (status === 520) {
197
198
  shouldShowToastr = true;
198
199
  if (globalProps.railsEnv === "production") {
@@ -225,15 +226,17 @@ var getUrlPathName = function getUrlPathName(url) {
225
226
  return url;
226
227
  }
227
228
  };
228
- var handle404ErrorResponse = function handle404ErrorResponse(error) {
229
+ var handleErrorPageResponse = function handleErrorPageResponse(error) {
229
230
  var _error$config4, _error$response4;
230
231
  var _ref5 = (_error$config4 = error.config) !== null && _error$config4 !== void 0 ? _error$config4 : {},
231
232
  _ref5$show404ErrorPag = _ref5.show404ErrorPage,
232
233
  show404ErrorPage = _ref5$show404ErrorPag === void 0 ? true : _ref5$show404ErrorPag,
233
234
  _ref5$show403ErrorPag = _ref5.show403ErrorPage,
234
- show403ErrorPage = _ref5$show403ErrorPag === void 0 ? true : _ref5$show403ErrorPag;
235
+ show403ErrorPage = _ref5$show403ErrorPag === void 0 ? true : _ref5$show403ErrorPag,
236
+ _ref5$show429ErrorPag = _ref5.show429ErrorPage,
237
+ show429ErrorPage = _ref5$show429ErrorPag === void 0 ? true : _ref5$show429ErrorPag;
235
238
  var status = (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.status;
236
- if (status === 404 && show404ErrorPage || status === 403 && show403ErrorPage) {
239
+ if (status === 404 && show404ErrorPage || status === 403 && show403ErrorPage || status === 429 && show429ErrorPage) {
237
240
  var _error$request;
238
241
  var fullUrl = ((_error$request = error.request) === null || _error$request === void 0 ? void 0 : _error$request.responseURL) || error.config.url;
239
242
  reactUtils_useDisplayErrorPage_useDisplayErrorPage.useErrorDisplayStore.setState({
@@ -248,7 +251,7 @@ var handle404ErrorResponse = function handle404ErrorResponse(error) {
248
251
  var buildErrorResponseHandler = function buildErrorResponseHandler(skip) {
249
252
  var interceptors = [];
250
253
  if (!(skip !== null && skip !== void 0 && skip.transformCase)) interceptors.push(transformErrorKeysToCamelCase);
251
- if (!(skip !== null && skip !== void 0 && skip.show404ErrorPage)) interceptors.push(handle404ErrorResponse);
254
+ if (!(skip !== null && skip !== void 0 && skip.show404ErrorPage)) interceptors.push(handleErrorPageResponse);
252
255
  if (!(skip !== null && skip !== void 0 && skip.logoutOn401)) interceptors.push(handleUnauthorizedErrorResponse);
253
256
  if (!(skip !== null && skip !== void 0 && skip.showToastr)) interceptors.push(showErrorToastr);
254
257
  if (!(skip !== null && skip !== void 0 && skip.checkForReleaseVersionMismatch)) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","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 // eslint-disable-next-line @bigbinary/neeto/use-show-thumbs-up-toastr\n Toastr.success(\"\", { icon: \"👍\", className: \"w-20\" });\n } else if (matches({ noticeCode: \"thumbs_up\" }, response.data)) {\n // @ts-ignore\n // eslint-disable-next-line @bigbinary/neeto/use-show-thumbs-up-toastr\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 checkForReleaseVersionMismatch = response => {\n const res = response?.response || response;\n const newReleaseVersion = Number(res?.headers?.[\"x-deploy-release-version\"]);\n const currentReleaseVersion = Number(globalProps?.deployReleaseVersion);\n\n if (\n newReleaseVersion &&\n currentReleaseVersion &&\n newReleaseVersion !== currentReleaseVersion\n ) {\n useErrorDisplayStore.setState({ showRefreshRibbon: true });\n }\n\n return response;\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?.checkForReleaseVersionMismatch) {\n interceptors.push(checkForReleaseVersionMismatch);\n }\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.noInternetConnection\")\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 if (status === 0) {\n toastrContent = i18next.t(\"neetoCommons.toastr.error.networkError\");\n shouldShowToastr = true;\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 if (!skip?.checkForReleaseVersionMismatch) {\n interceptors.push(checkForReleaseVersionMismatch);\n }\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"],"names":["checkOnlineInterval","requestErrorToasts","shouldNot","skip","_typeof","shouldShowToastr","response","isNotEmpty","notice","noticeCode","setAuthHeaders","_document$querySelect","axios","defaults","headers","_defineProperty","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","checkForReleaseVersionMismatch","_res$headers","_globalProps","res","newReleaseVersion","Number","currentReleaseVersion","globalProps","deployReleaseVersion","useErrorDisplayStore","setState","showRefreshRibbon","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","railsEnv","getUrlPathName","URL","_unused","handle404ErrorResponse","_error$config4","_error$response4","_ref5","_ref5$show404ErrorPag","show404ErrorPage","_ref5$show403ErrorPag","show403ErrorPage","_error$request","fullUrl","request","responseURL","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"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,IAAIA,mBAAmB,GAAG,IAAI;AAC9B,IAAIC,kBAAkB,GAAG,EAAE;AAE3B,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAGC,IAAI,EAAA;AAAA,EAAA,OAAIC,eAAA,CAAOD,IAAI,MAAK,QAAQ,IAAI,CAACA,IAAI;AAAA,CAAA;AAE3D,IAAME,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAGC,QAAQ,EAAA;AAAA,EAAA,OAC9B,OAAOA,QAAQ,KAAK,QAAQ,IAAIC,oBAAU,CAACD,QAAQ,CAAC,IACpDF,eAAA,CAAOE,QAAQ,MAAK,QAAQ,KAAK,CAAAA,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAA,MAAA,GAAA,MAAA,GAARA,QAAQ,CAAEE,MAAM,MAAIF,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAA,MAA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ChC,CAAC;AACH,CAAC;AAED,IAAMiK,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAGjK,IAAI,EAAI;EACjC,IAAID,SAAS,CAACC,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJA,IAAI,CAAEyI,OAAO,CAAC,EAAEoB,sBAAsB,CAAC7J,IAAI,KAAA,IAAA,IAAJA,IAAI,uBAAJA,IAAI,CAAEyI,OAAO,CAAC;EAEnE,IAAI1I,SAAS,CAACC,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJA,IAAI,CAAEG,QAAQ,CAAC,EAAE6J,uBAAuB,CAAChK,IAAI,KAAA,IAAA,IAAJA,IAAI,uBAAJA,IAAI,CAAEG,QAAQ,CAAC;AACxE,CAAC;AAEc,SAAS+J,eAAeA,CAAClK,IAAI,EAAE;AAC5C,EAAA,IAAI,EAACA,IAAI,KAAA,IAAA,IAAJA,IAAI,eAAJA,IAAI,CAAEmK,OAAO,CAAA,EAAE1J,KAAK,CAACC,QAAQ,CAACyJ,OAAO,GAAG,GAAG;EAEhD,IAAI,EAACnK,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,IAAJA,IAAI,CAAEoK,WAAW,CAAA,EAAE7J,cAAc,EAAE;EAExC,IAAI,EAACP,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,IAAJA,IAAI,CAAEqK,gBAAgB,CAAA,EAAEC,8CAAmB,EAAE;EAElD,IAAIvK,SAAS,CAACC,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJA,IAAI,CAAEyE,YAAY,CAAC,EAAEwF,kBAAkB,CAACjK,IAAI,KAAA,IAAA,IAAJA,IAAI,uBAAJA,IAAI,CAAEyE,YAAY,CAAC;AAC3E;;;;"}
1
+ {"version":3,"file":"index.js","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 // eslint-disable-next-line @bigbinary/neeto/use-show-thumbs-up-toastr\n Toastr.success(\"\", { icon: \"👍\", className: \"w-20\" });\n } else if (matches({ noticeCode: \"thumbs_up\" }, response.data)) {\n // @ts-ignore\n // eslint-disable-next-line @bigbinary/neeto/use-show-thumbs-up-toastr\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 checkForReleaseVersionMismatch = response => {\n const res = response?.response || response;\n const newReleaseVersion = Number(res?.headers?.[\"x-deploy-release-version\"]);\n const currentReleaseVersion = Number(globalProps?.deployReleaseVersion);\n\n if (\n newReleaseVersion &&\n currentReleaseVersion &&\n newReleaseVersion !== currentReleaseVersion\n ) {\n useErrorDisplayStore.setState({ showRefreshRibbon: true });\n }\n\n return response;\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?.checkForReleaseVersionMismatch) {\n interceptors.push(checkForReleaseVersionMismatch);\n }\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 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.noInternetConnection\")\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 show429ErrorPage = 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 === 429 && show429ErrorPage) shouldShowToastr = false;\n\n if (status === 520) {\n shouldShowToastr = true;\n if (globalProps.railsEnv === \"production\") {\n toastrContent = i18next.t(\"generic.error\");\n }\n }\n\n if (status === 0) {\n toastrContent = i18next.t(\"neetoCommons.toastr.error.networkError\");\n shouldShowToastr = true;\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 handleErrorPageResponse = error => {\n const {\n show404ErrorPage = true,\n show403ErrorPage = true,\n show429ErrorPage = true,\n } = error.config ?? {};\n\n const status = error.response?.status;\n if (\n (status === 404 && show404ErrorPage) ||\n (status === 403 && show403ErrorPage) ||\n (status === 429 && show429ErrorPage)\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(handleErrorPageResponse);\n\n if (!skip?.logoutOn401) interceptors.push(handleUnauthorizedErrorResponse);\n\n if (!skip?.showToastr) interceptors.push(showErrorToastr);\n\n if (!skip?.checkForReleaseVersionMismatch) {\n interceptors.push(checkForReleaseVersionMismatch);\n }\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"],"names":["checkOnlineInterval","requestErrorToasts","shouldNot","skip","_typeof","shouldShowToastr","response","isNotEmpty","notice","noticeCode","setAuthHeaders","_document$querySelect","axios","defaults","headers","_defineProperty","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","checkForReleaseVersionMismatch","_res$headers","_globalProps","res","newReleaseVersion","Number","currentReleaseVersion","globalProps","deployReleaseVersion","useErrorDisplayStore","setState","showRefreshRibbon","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$show429ErrorPag","show429ErrorPage","_ref3$url","_ref3$method","_ref4","message","code","toastrContent","skippedStatusCodes","includes","isCancel","railsEnv","getUrlPathName","URL","_unused","handleErrorPageResponse","_error$config4","_error$response4","_ref5","_ref5$show404ErrorPag","show404ErrorPage","_ref5$show403ErrorPag","show403ErrorPage","_ref5$show429ErrorPag","_error$request","fullUrl","request","responseURL","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"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,IAAIA,mBAAmB,GAAG,IAAI;AAC9B,IAAIC,kBAAkB,GAAG,EAAE;AAE3B,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAGC,IAAI,EAAA;AAAA,EAAA,OAAIC,eAAA,CAAOD,IAAI,MAAK,QAAQ,IAAI,CAACA,IAAI;AAAA,CAAA;AAE3D,IAAME,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAGC,QAAQ,EAAA;AAAA,EAAA,OAC9B,OAAOA,QAAQ,KAAK,QAAQ,IAAIC,oBAAU,CAACD,QAAQ,CAAC,IACpDF,eAAA,CAAOE,QAAQ,MAAK,QAAQ,KAAK,CAAAA,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAA,MAAA,GAAA,MAAA,GAARA,QAAQ,CAAEE,MAAM,MAAIF,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAA,MA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AAA,MAAA,IAAJA,IAAI,CAAEwK,gBAAgB,CAAA,EAAEC,8CAAmB,EAAE;EAElD,IAAI1K,SAAS,CAACC,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJA,IAAI,CAAEyE,YAAY,CAAC,EAAE2F,kBAAkB,CAACpK,IAAI,KAAA,IAAA,IAAJA,IAAI,uBAAJA,IAAI,CAAEyE,YAAY,CAAC;AAC3E;;;;"}
@@ -124,8 +124,6 @@ var handleUnauthorizedErrorResponse = function handleUnauthorizedErrorResponse(e
124
124
  if (redirectOnError) {
125
125
  setTimeout(function () {
126
126
  var redirectTo = window.location.pathname === "/login" ? "/login" : "/login?redirect_uri=".concat(encodeURIComponent(window.location.href));
127
-
128
- // eslint-disable-next-line xss/no-location-href-assign
129
127
  window.location.href = redirectTo;
130
128
  }, 300);
131
129
  }
@@ -167,6 +165,8 @@ var showErrorToastr = function showErrorToastr(error) {
167
165
  showToastr = _ref3$showToastr === void 0 ? true : _ref3$showToastr,
168
166
  _ref3$show422ErrorToa = _ref3.show422ErrorToastr,
169
167
  show422ErrorToastr = _ref3$show422ErrorToa === void 0 ? true : _ref3$show422ErrorToa,
168
+ _ref3$show429ErrorPag = _ref3.show429ErrorPage,
169
+ show429ErrorPage = _ref3$show429ErrorPag === void 0 ? true : _ref3$show429ErrorPag,
170
170
  _ref3$url = _ref3.url,
171
171
  requestUrl = _ref3$url === void 0 ? "" : _ref3$url,
172
172
  _ref3$method = _ref3.method,
@@ -187,6 +187,7 @@ var showErrorToastr = function showErrorToastr(error) {
187
187
  shouldShowToastr = true;
188
188
  }
189
189
  if (status === 422 && show422ErrorToastr) shouldShowToastr = true;
190
+ if (status === 429 && show429ErrorPage) shouldShowToastr = false;
190
191
  if (status === 520) {
191
192
  shouldShowToastr = true;
192
193
  if (globalProps.railsEnv === "production") {
@@ -219,15 +220,17 @@ var getUrlPathName = function getUrlPathName(url) {
219
220
  return url;
220
221
  }
221
222
  };
222
- var handle404ErrorResponse = function handle404ErrorResponse(error) {
223
+ var handleErrorPageResponse = function handleErrorPageResponse(error) {
223
224
  var _error$config4, _error$response4;
224
225
  var _ref5 = (_error$config4 = error.config) !== null && _error$config4 !== void 0 ? _error$config4 : {},
225
226
  _ref5$show404ErrorPag = _ref5.show404ErrorPage,
226
227
  show404ErrorPage = _ref5$show404ErrorPag === void 0 ? true : _ref5$show404ErrorPag,
227
228
  _ref5$show403ErrorPag = _ref5.show403ErrorPage,
228
- show403ErrorPage = _ref5$show403ErrorPag === void 0 ? true : _ref5$show403ErrorPag;
229
+ show403ErrorPage = _ref5$show403ErrorPag === void 0 ? true : _ref5$show403ErrorPag,
230
+ _ref5$show429ErrorPag = _ref5.show429ErrorPage,
231
+ show429ErrorPage = _ref5$show429ErrorPag === void 0 ? true : _ref5$show429ErrorPag;
229
232
  var status = (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.status;
230
- if (status === 404 && show404ErrorPage || status === 403 && show403ErrorPage) {
233
+ if (status === 404 && show404ErrorPage || status === 403 && show403ErrorPage || status === 429 && show429ErrorPage) {
231
234
  var _error$request;
232
235
  var fullUrl = ((_error$request = error.request) === null || _error$request === void 0 ? void 0 : _error$request.responseURL) || error.config.url;
233
236
  v2_reactUtils_useDisplayErrorPage_useDisplayErrorPage.useErrorDisplayStore.setState({
@@ -242,7 +245,7 @@ var handle404ErrorResponse = function handle404ErrorResponse(error) {
242
245
  var buildErrorResponseHandler = function buildErrorResponseHandler(skip) {
243
246
  var interceptors = [];
244
247
  if (!(skip !== null && skip !== void 0 && skip.transformCase)) interceptors.push(transformErrorKeysToCamelCase);
245
- if (!(skip !== null && skip !== void 0 && skip.show404ErrorPage)) interceptors.push(handle404ErrorResponse);
248
+ if (!(skip !== null && skip !== void 0 && skip.show404ErrorPage)) interceptors.push(handleErrorPageResponse);
246
249
  if (!(skip !== null && skip !== void 0 && skip.logoutOn401)) interceptors.push(handleUnauthorizedErrorResponse);
247
250
  if (!(skip !== null && skip !== void 0 && skip.showToastr)) interceptors.push(showErrorToastr);
248
251
  if (!(skip !== null && skip !== void 0 && skip.checkForReleaseVersionMismatch)) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/v2/initializers/axiosInitializer/index.js"],"sourcesContent":["import { Toastr } from \"@bigbinary/neeto-atoms\";\nimport axios from \"axios\";\nimport i18next from \"i18next\";\nimport {\n isNotEmpty,\n keysToCamelCase,\n matches,\n serializeKeysToSnakeCase,\n} from \"neetocist\";\nimport { dissoc, evolve, omit } from \"ramda\";\nimport { toast } from \"react-toastify\";\nimport { useErrorDisplayStore } from \"v2/react-utils/useDisplayErrorPage\";\nimport { resetAuthTokens } from \"v2/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 Toastr.success(\"👍\", { showIcon: false });\n } else if (matches({ noticeCode: \"thumbs_up\" }, response.data)) {\n Toastr.success(\"👍\", { showIcon: false });\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 checkForReleaseVersionMismatch = response => {\n const res = response?.response || response;\n const newReleaseVersion = Number(res?.headers?.[\"x-deploy-release-version\"]);\n const currentReleaseVersion = Number(globalProps?.deployReleaseVersion);\n\n if (\n newReleaseVersion &&\n currentReleaseVersion &&\n newReleaseVersion !== currentReleaseVersion\n ) {\n useErrorDisplayStore.setState({ showRefreshRibbon: true });\n }\n\n return response;\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?.checkForReleaseVersionMismatch) {\n interceptors.push(checkForReleaseVersionMismatch);\n }\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.noInternetConnection\")\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 if (status === 0) {\n toastrContent = i18next.t(\"neetoCommons.toastr.error.networkError\");\n shouldShowToastr = true;\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 if (!skip?.checkForReleaseVersionMismatch) {\n interceptors.push(checkForReleaseVersionMismatch);\n }\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"],"names":["checkOnlineInterval","requestErrorToasts","shouldNot","skip","_typeof","shouldShowToastr","response","isNotEmpty","notice","noticeCode","setAuthHeaders","_document$querySelect","axios","defaults","headers","_defineProperty","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","showIcon","pullDataFromResponse","_response$config$incl","includeMetadataInResponse","checkForReleaseVersionMismatch","_res$headers","_globalProps","res","newReleaseVersion","Number","currentReleaseVersion","globalProps","deployReleaseVersion","useErrorDisplayStore","setState","showRefreshRibbon","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","railsEnv","getUrlPathName","URL","_unused","handle404ErrorResponse","_error$config4","_error$response4","_ref5","_ref5$show404ErrorPag","show404ErrorPage","_ref5$show403ErrorPag","show403ErrorPage","_error$request","fullUrl","request","responseURL","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"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,IAAIA,mBAAmB,GAAG,IAAI;AAC9B,IAAIC,kBAAkB,GAAG,EAAE;AAE3B,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAGC,IAAI,EAAA;AAAA,EAAA,OAAIC,eAAA,CAAOD,IAAI,MAAK,QAAQ,IAAI,CAACA,IAAI;AAAA,CAAA;AAE3D,IAAME,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAGC,QAAQ,EAAA;AAAA,EAAA,OAC9B,OAAOA,QAAQ,KAAK,QAAQ,IAAIC,oBAAU,CAACD,QAAQ,CAAC,IACpDF,eAAA,CAAOE,QAAQ,MAAK,QAAQ,KAAK,CAAAA,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAA,MAAA,GAAA,MAAA,GAARA,QAAQ,CAAEE,MAAM,MAAIF,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAA,MAAA,GAAA,MAAA,GAARA,QAAQ,CAAEG,UAAU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C,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJA,IAAI,CAAEwI,OAAO,CAAC,EAAEoB,sBAAsB,CAAC5J,IAAI,KAAA,IAAA,IAAJA,IAAI,uBAAJA,IAAI,CAAEwI,OAAO,CAAC;EAEnE,IAAIzI,SAAS,CAACC,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJA,IAAI,CAAEG,QAAQ,CAAC,EAAE4J,uBAAuB,CAAC/J,IAAI,KAAA,IAAA,IAAJA,IAAI,uBAAJA,IAAI,CAAEG,QAAQ,CAAC;AACxE,CAAC;AAEc,SAAS8J,eAAeA,CAACjK,IAAI,EAAE;AAC5C,EAAA,IAAI,EAACA,IAAI,KAAA,IAAA,IAAJA,IAAI,eAAJA,IAAI,CAAEkK,OAAO,CAAA,EAAEzJ,KAAK,CAACC,QAAQ,CAACwJ,OAAO,GAAG,GAAG;EAEhD,IAAI,EAAClK,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,IAAJA,IAAI,CAAEmK,WAAW,CAAA,EAAE5J,cAAc,EAAE;EAExC,IAAI,EAACP,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,IAAJA,IAAI,CAAEoK,gBAAgB,CAAA,EAAEC,iDAAmB,EAAE;EAElD,IAAItK,SAAS,CAACC,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJA,IAAI,CAAEwE,YAAY,CAAC,EAAEwF,kBAAkB,CAAChK,IAAI,KAAA,IAAA,IAAJA,IAAI,uBAAJA,IAAI,CAAEwE,YAAY,CAAC;AAC3E;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/v2/initializers/axiosInitializer/index.js"],"sourcesContent":["import { Toastr } from \"@bigbinary/neeto-atoms\";\nimport axios from \"axios\";\nimport i18next from \"i18next\";\nimport {\n isNotEmpty,\n keysToCamelCase,\n matches,\n serializeKeysToSnakeCase,\n} from \"neetocist\";\nimport { dissoc, evolve, omit } from \"ramda\";\nimport { toast } from \"react-toastify\";\nimport { useErrorDisplayStore } from \"v2/react-utils/useDisplayErrorPage\";\nimport { resetAuthTokens } from \"v2/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 Toastr.success(\"👍\", { showIcon: false });\n } else if (matches({ noticeCode: \"thumbs_up\" }, response.data)) {\n Toastr.success(\"👍\", { showIcon: false });\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 checkForReleaseVersionMismatch = response => {\n const res = response?.response || response;\n const newReleaseVersion = Number(res?.headers?.[\"x-deploy-release-version\"]);\n const currentReleaseVersion = Number(globalProps?.deployReleaseVersion);\n\n if (\n newReleaseVersion &&\n currentReleaseVersion &&\n newReleaseVersion !== currentReleaseVersion\n ) {\n useErrorDisplayStore.setState({ showRefreshRibbon: true });\n }\n\n return response;\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?.checkForReleaseVersionMismatch) {\n interceptors.push(checkForReleaseVersionMismatch);\n }\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 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.noInternetConnection\")\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 show429ErrorPage = 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 === 429 && show429ErrorPage) shouldShowToastr = false;\n\n if (status === 520) {\n shouldShowToastr = true;\n if (globalProps.railsEnv === \"production\") {\n toastrContent = i18next.t(\"generic.error\");\n }\n }\n\n if (status === 0) {\n toastrContent = i18next.t(\"neetoCommons.toastr.error.networkError\");\n shouldShowToastr = true;\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 handleErrorPageResponse = error => {\n const {\n show404ErrorPage = true,\n show403ErrorPage = true,\n show429ErrorPage = true,\n } = error.config ?? {};\n\n const status = error.response?.status;\n if (\n (status === 404 && show404ErrorPage) ||\n (status === 403 && show403ErrorPage) ||\n (status === 429 && show429ErrorPage)\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(handleErrorPageResponse);\n\n if (!skip?.logoutOn401) interceptors.push(handleUnauthorizedErrorResponse);\n\n if (!skip?.showToastr) interceptors.push(showErrorToastr);\n\n if (!skip?.checkForReleaseVersionMismatch) {\n interceptors.push(checkForReleaseVersionMismatch);\n }\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"],"names":["checkOnlineInterval","requestErrorToasts","shouldNot","skip","_typeof","shouldShowToastr","response","isNotEmpty","notice","noticeCode","setAuthHeaders","_document$querySelect","axios","defaults","headers","_defineProperty","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","showIcon","pullDataFromResponse","_response$config$incl","includeMetadataInResponse","checkForReleaseVersionMismatch","_res$headers","_globalProps","res","newReleaseVersion","Number","currentReleaseVersion","globalProps","deployReleaseVersion","useErrorDisplayStore","setState","showRefreshRibbon","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$show429ErrorPag","show429ErrorPage","_ref3$url","_ref3$method","_ref4","message","code","toastrContent","skippedStatusCodes","includes","isCancel","railsEnv","getUrlPathName","URL","_unused","handleErrorPageResponse","_error$config4","_error$response4","_ref5","_ref5$show404ErrorPag","show404ErrorPage","_ref5$show403ErrorPag","show403ErrorPage","_ref5$show429ErrorPag","_error$request","fullUrl","request","responseURL","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"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,IAAIA,mBAAmB,GAAG,IAAI;AAC9B,IAAIC,kBAAkB,GAAG,EAAE;AAE3B,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAGC,IAAI,EAAA;AAAA,EAAA,OAAIC,eAAA,CAAOD,IAAI,MAAK,QAAQ,IAAI,CAACA,IAAI;AAAA,CAAA;AAE3D,IAAME,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAGC,QAAQ,EAAA;AAAA,EAAA,OAC9B,OAAOA,QAAQ,KAAK,QAAQ,IAAIC,oBAAU,CAACD,QAAQ,CAAC,IACpDF,eAAA,CAAOE,QAAQ,MAAK,QAAQ,KAAK,CAAAA,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAA,MAAA,GAAA,MAAA,GAARA,QAAQ,CAAEE,MAAM,MAAIF,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAA,MAAA,GAAA,MAAA,GAARA,QAAQ,CAAEG,UAAU,CAAA,CAAE;AAAA,CAAA;AAE9E,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,GAAS;AAAA,EAAA,IAAAC,qBAAA;AAC3B;EACAC,KAAK,CAACC,QAAQ,CAACC,OAAO,GAAAC,8BAAA,CAAAA,8BAAA,CAAAA,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}
@@ -128,8 +128,6 @@ var handleUnauthorizedErrorResponse = function handleUnauthorizedErrorResponse(e
128
128
  if (redirectOnError) {
129
129
  setTimeout(function () {
130
130
  var redirectTo = window.location.pathname === "/login" ? "/login" : "/login?redirect_uri=".concat(encodeURIComponent(window.location.href));
131
-
132
- // eslint-disable-next-line xss/no-location-href-assign
133
131
  window.location.href = redirectTo;
134
132
  }, 300);
135
133
  }
@@ -171,6 +169,8 @@ var showErrorToastr = function showErrorToastr(error) {
171
169
  showToastr = _ref3$showToastr === void 0 ? true : _ref3$showToastr,
172
170
  _ref3$show422ErrorToa = _ref3.show422ErrorToastr,
173
171
  show422ErrorToastr = _ref3$show422ErrorToa === void 0 ? true : _ref3$show422ErrorToa,
172
+ _ref3$show429ErrorPag = _ref3.show429ErrorPage,
173
+ show429ErrorPage = _ref3$show429ErrorPag === void 0 ? true : _ref3$show429ErrorPag,
174
174
  _ref3$url = _ref3.url,
175
175
  requestUrl = _ref3$url === void 0 ? "" : _ref3$url,
176
176
  _ref3$method = _ref3.method,
@@ -191,6 +191,7 @@ var showErrorToastr = function showErrorToastr(error) {
191
191
  shouldShowToastr = true;
192
192
  }
193
193
  if (status === 422 && show422ErrorToastr) shouldShowToastr = true;
194
+ if (status === 429 && show429ErrorPage) shouldShowToastr = false;
194
195
  if (status === 520) {
195
196
  shouldShowToastr = true;
196
197
  if (globalProps.railsEnv === "production") {
@@ -223,15 +224,17 @@ var getUrlPathName = function getUrlPathName(url) {
223
224
  return url;
224
225
  }
225
226
  };
226
- var handle404ErrorResponse = function handle404ErrorResponse(error) {
227
+ var handleErrorPageResponse = function handleErrorPageResponse(error) {
227
228
  var _error$config4, _error$response4;
228
229
  var _ref5 = (_error$config4 = error.config) !== null && _error$config4 !== void 0 ? _error$config4 : {},
229
230
  _ref5$show404ErrorPag = _ref5.show404ErrorPage,
230
231
  show404ErrorPage = _ref5$show404ErrorPag === void 0 ? true : _ref5$show404ErrorPag,
231
232
  _ref5$show403ErrorPag = _ref5.show403ErrorPage,
232
- show403ErrorPage = _ref5$show403ErrorPag === void 0 ? true : _ref5$show403ErrorPag;
233
+ show403ErrorPage = _ref5$show403ErrorPag === void 0 ? true : _ref5$show403ErrorPag,
234
+ _ref5$show429ErrorPag = _ref5.show429ErrorPage,
235
+ show429ErrorPage = _ref5$show429ErrorPag === void 0 ? true : _ref5$show429ErrorPag;
233
236
  var status = (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.status;
234
- if (status === 404 && show404ErrorPage || status === 403 && show403ErrorPage) {
237
+ if (status === 404 && show404ErrorPage || status === 403 && show403ErrorPage || status === 429 && show429ErrorPage) {
235
238
  var _error$request;
236
239
  var fullUrl = ((_error$request = error.request) === null || _error$request === void 0 ? void 0 : _error$request.responseURL) || error.config.url;
237
240
  useErrorDisplayStore.setState({
@@ -246,7 +249,7 @@ var handle404ErrorResponse = function handle404ErrorResponse(error) {
246
249
  var buildErrorResponseHandler = function buildErrorResponseHandler(skip) {
247
250
  var interceptors = [];
248
251
  if (!(skip !== null && skip !== void 0 && skip.transformCase)) interceptors.push(transformErrorKeysToCamelCase);
249
- if (!(skip !== null && skip !== void 0 && skip.show404ErrorPage)) interceptors.push(handle404ErrorResponse);
252
+ if (!(skip !== null && skip !== void 0 && skip.show404ErrorPage)) interceptors.push(handleErrorPageResponse);
250
253
  if (!(skip !== null && skip !== void 0 && skip.logoutOn401)) interceptors.push(handleUnauthorizedErrorResponse);
251
254
  if (!(skip !== null && skip !== void 0 && skip.showToastr)) interceptors.push(showErrorToastr);
252
255
  if (!(skip !== null && skip !== void 0 && skip.checkForReleaseVersionMismatch)) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","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 // eslint-disable-next-line @bigbinary/neeto/use-show-thumbs-up-toastr\n Toastr.success(\"\", { icon: \"👍\", className: \"w-20\" });\n } else if (matches({ noticeCode: \"thumbs_up\" }, response.data)) {\n // @ts-ignore\n // eslint-disable-next-line @bigbinary/neeto/use-show-thumbs-up-toastr\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 checkForReleaseVersionMismatch = response => {\n const res = response?.response || response;\n const newReleaseVersion = Number(res?.headers?.[\"x-deploy-release-version\"]);\n const currentReleaseVersion = Number(globalProps?.deployReleaseVersion);\n\n if (\n newReleaseVersion &&\n currentReleaseVersion &&\n newReleaseVersion !== currentReleaseVersion\n ) {\n useErrorDisplayStore.setState({ showRefreshRibbon: true });\n }\n\n return response;\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?.checkForReleaseVersionMismatch) {\n interceptors.push(checkForReleaseVersionMismatch);\n }\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.noInternetConnection\")\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 if (status === 0) {\n toastrContent = i18next.t(\"neetoCommons.toastr.error.networkError\");\n shouldShowToastr = true;\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 if (!skip?.checkForReleaseVersionMismatch) {\n interceptors.push(checkForReleaseVersionMismatch);\n }\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"],"names":["checkOnlineInterval","requestErrorToasts","shouldNot","skip","_typeof","shouldShowToastr","response","isNotEmpty","notice","noticeCode","setAuthHeaders","_document$querySelect","axios","defaults","headers","_defineProperty","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","checkForReleaseVersionMismatch","_res$headers","_globalProps","res","newReleaseVersion","Number","currentReleaseVersion","globalProps","deployReleaseVersion","useErrorDisplayStore","setState","showRefreshRibbon","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","railsEnv","getUrlPathName","URL","_unused","handle404ErrorResponse","_error$config4","_error$response4","_ref5","_ref5$show404ErrorPag","show404ErrorPage","_ref5$show403ErrorPag","show403ErrorPage","_error$request","fullUrl","request","responseURL","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"],"mappings":";;;;;;;;;;;;;;;;AAkBA,IAAIA,mBAAmB,GAAG,IAAI;AAC9B,IAAIC,kBAAkB,GAAG,EAAE;AAE3B,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAGC,IAAI,EAAA;AAAA,EAAA,OAAIC,OAAA,CAAOD,IAAI,MAAK,QAAQ,IAAI,CAACA,IAAI;AAAA,CAAA;AAE3D,IAAME,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAGC,QAAQ,EAAA;AAAA,EAAA,OAC9B,OAAOA,QAAQ,KAAK,QAAQ,IAAIC,UAAU,CAACD,QAAQ,CAAC,IACpDF,OAAA,CAAOE,QAAQ,MAAK,QAAQ,KAAK,CAAAA,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAA,MAAA,GAAA,MAAA,GAARA,QAAQ,CAAEE,MAAM,MAAIF,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAA,MAAA,GAAA,MAAA,GAARA,QAAQ,CAAEG,UAAU,CAAA,CAAE;AAAA,CAAA;AAE9E,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,GAAS;AAAA,EAAA,IAAAC,qBAAA;AAC3B;EACAC,KAAK,CAACC,QAAQ,CAACC,OAAO,GAAAC,eAAA,CAAAA,eAAA,CAAAA,eAAA,KACnBC,YAAY,CAACC,MAAM,EAA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AAEyI,OAAO,CAAC;EAEnE,IAAI1I,SAAS,CAACC,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJA,IAAI,CAAEG,QAAQ,CAAC,EAAE6J,uBAAuB,CAAChK,IAAI,KAAA,IAAA,IAAJA,IAAI,uBAAJA,IAAI,CAAEG,QAAQ,CAAC;AACxE,CAAC;AAEc,SAAS+J,eAAeA,CAAClK,IAAI,EAAE;AAC5C,EAAA,IAAI,EAACA,IAAI,KAAA,IAAA,IAAJA,IAAI,eAAJA,IAAI,CAAEmK,OAAO,CAAA,EAAE1J,KAAK,CAACC,QAAQ,CAACyJ,OAAO,GAAG,GAAG;EAEhD,IAAI,EAACnK,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,IAAJA,IAAI,CAAEoK,WAAW,CAAA,EAAE7J,cAAc,EAAE;EAExC,IAAI,EAACP,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,IAAJA,IAAI,CAAEqK,gBAAgB,CAAA,EAAEC,mBAAmB,EAAE;EAElD,IAAIvK,SAAS,CAACC,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJA,IAAI,CAAEyE,YAAY,CAAC,EAAEwF,kBAAkB,CAACjK,IAAI,KAAA,IAAA,IAAJA,IAAI,uBAAJA,IAAI,CAAEyE,YAAY,CAAC;AAC3E;;;;"}
1
+ {"version":3,"file":"index.js","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 // eslint-disable-next-line @bigbinary/neeto/use-show-thumbs-up-toastr\n Toastr.success(\"\", { icon: \"👍\", className: \"w-20\" });\n } else if (matches({ noticeCode: \"thumbs_up\" }, response.data)) {\n // @ts-ignore\n // eslint-disable-next-line @bigbinary/neeto/use-show-thumbs-up-toastr\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 checkForReleaseVersionMismatch = response => {\n const res = response?.response || response;\n const newReleaseVersion = Number(res?.headers?.[\"x-deploy-release-version\"]);\n const currentReleaseVersion = Number(globalProps?.deployReleaseVersion);\n\n if (\n newReleaseVersion &&\n currentReleaseVersion &&\n newReleaseVersion !== currentReleaseVersion\n ) {\n useErrorDisplayStore.setState({ showRefreshRibbon: true });\n }\n\n return response;\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?.checkForReleaseVersionMismatch) {\n interceptors.push(checkForReleaseVersionMismatch);\n }\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 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.noInternetConnection\")\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 show429ErrorPage = 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 === 429 && show429ErrorPage) shouldShowToastr = false;\n\n if (status === 520) {\n shouldShowToastr = true;\n if (globalProps.railsEnv === \"production\") {\n toastrContent = i18next.t(\"generic.error\");\n }\n }\n\n if (status === 0) {\n toastrContent = i18next.t(\"neetoCommons.toastr.error.networkError\");\n shouldShowToastr = true;\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 handleErrorPageResponse = error => {\n const {\n show404ErrorPage = true,\n show403ErrorPage = true,\n show429ErrorPage = true,\n } = error.config ?? {};\n\n const status = error.response?.status;\n if (\n (status === 404 && show404ErrorPage) ||\n (status === 403 && show403ErrorPage) ||\n (status === 429 && show429ErrorPage)\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(handleErrorPageResponse);\n\n if (!skip?.logoutOn401) interceptors.push(handleUnauthorizedErrorResponse);\n\n if (!skip?.showToastr) interceptors.push(showErrorToastr);\n\n if (!skip?.checkForReleaseVersionMismatch) {\n interceptors.push(checkForReleaseVersionMismatch);\n }\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"],"names":["checkOnlineInterval","requestErrorToasts","shouldNot","skip","_typeof","shouldShowToastr","response","isNotEmpty","notice","noticeCode","setAuthHeaders","_document$querySelect","axios","defaults","headers","_defineProperty","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","checkForReleaseVersionMismatch","_res$headers","_globalProps","res","newReleaseVersion","Number","currentReleaseVersion","globalProps","deployReleaseVersion","useErrorDisplayStore","setState","showRefreshRibbon","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$show429ErrorPag","show429ErrorPage","_ref3$url","_ref3$method","_ref4","message","code","toastrContent","skippedStatusCodes","includes","isCancel","railsEnv","getUrlPathName","URL","_unused","handleErrorPageResponse","_error$config4","_error$response4","_ref5","_ref5$show404ErrorPag","show404ErrorPage","_ref5$show403ErrorPag","show403ErrorPage","_ref5$show429ErrorPag","_error$request","fullUrl","request","responseURL","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"],"mappings":";;;;;;;;;;;;;;;;AAkBA,IAAIA,mBAAmB,GAAG,IAAI;AAC9B,IAAIC,kBAAkB,GAAG,EAAE;AAE3B,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAGC,IAAI,EAAA;AAAA,EAAA,OAAIC,OAAA,CAAOD,IAAI,MAAK,QAAQ,IAAI,CAACA,IAAI;AAAA,CAAA;AAE3D,IAAME,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAGC,QAAQ,EAAA;AAAA,EAAA,OAC9B,OAAOA,QAAQ,KAAK,QAAQ,IAAIC,UAAU,CAACD,QAAQ,CAAC,IACpDF,OAAA,CAAOE,QAAQ,MAAK,QAAQ,KAAK,CAAAA,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAA,MAAA,GAAA,MAAA,GAARA,QAAQ,CAAEE,MAAM,MAAIF,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAA,MAAA,GAAA,MAAA,GAARA,QAAQ,CAAEG,UAAU,CAAA,CAAE;AAAA,CAAA;AAE9E,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,GAAS;AAAA,EAAA,IAAAC,qBAAA;AAC3B;EACAC,KAAK,CAACC,QAAQ,CAACC,OAAO,GAAAC,eAAA,CAAAA,eAAA,CAAAA,eAAA,KACnBC,YAAY,CAACC,MAAM,EAAG,kBAAkB,GACxCD,YAA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122,8 +122,6 @@ var handleUnauthorizedErrorResponse = function handleUnauthorizedErrorResponse(e
122
122
  if (redirectOnError) {
123
123
  setTimeout(function () {
124
124
  var redirectTo = window.location.pathname === "/login" ? "/login" : "/login?redirect_uri=".concat(encodeURIComponent(window.location.href));
125
-
126
- // eslint-disable-next-line xss/no-location-href-assign
127
125
  window.location.href = redirectTo;
128
126
  }, 300);
129
127
  }
@@ -165,6 +163,8 @@ var showErrorToastr = function showErrorToastr(error) {
165
163
  showToastr = _ref3$showToastr === void 0 ? true : _ref3$showToastr,
166
164
  _ref3$show422ErrorToa = _ref3.show422ErrorToastr,
167
165
  show422ErrorToastr = _ref3$show422ErrorToa === void 0 ? true : _ref3$show422ErrorToa,
166
+ _ref3$show429ErrorPag = _ref3.show429ErrorPage,
167
+ show429ErrorPage = _ref3$show429ErrorPag === void 0 ? true : _ref3$show429ErrorPag,
168
168
  _ref3$url = _ref3.url,
169
169
  requestUrl = _ref3$url === void 0 ? "" : _ref3$url,
170
170
  _ref3$method = _ref3.method,
@@ -185,6 +185,7 @@ var showErrorToastr = function showErrorToastr(error) {
185
185
  shouldShowToastr = true;
186
186
  }
187
187
  if (status === 422 && show422ErrorToastr) shouldShowToastr = true;
188
+ if (status === 429 && show429ErrorPage) shouldShowToastr = false;
188
189
  if (status === 520) {
189
190
  shouldShowToastr = true;
190
191
  if (globalProps.railsEnv === "production") {
@@ -217,15 +218,17 @@ var getUrlPathName = function getUrlPathName(url) {
217
218
  return url;
218
219
  }
219
220
  };
220
- var handle404ErrorResponse = function handle404ErrorResponse(error) {
221
+ var handleErrorPageResponse = function handleErrorPageResponse(error) {
221
222
  var _error$config4, _error$response4;
222
223
  var _ref5 = (_error$config4 = error.config) !== null && _error$config4 !== void 0 ? _error$config4 : {},
223
224
  _ref5$show404ErrorPag = _ref5.show404ErrorPage,
224
225
  show404ErrorPage = _ref5$show404ErrorPag === void 0 ? true : _ref5$show404ErrorPag,
225
226
  _ref5$show403ErrorPag = _ref5.show403ErrorPage,
226
- show403ErrorPage = _ref5$show403ErrorPag === void 0 ? true : _ref5$show403ErrorPag;
227
+ show403ErrorPage = _ref5$show403ErrorPag === void 0 ? true : _ref5$show403ErrorPag,
228
+ _ref5$show429ErrorPag = _ref5.show429ErrorPage,
229
+ show429ErrorPage = _ref5$show429ErrorPag === void 0 ? true : _ref5$show429ErrorPag;
227
230
  var status = (_error$response4 = error.response) === null || _error$response4 === void 0 ? void 0 : _error$response4.status;
228
- if (status === 404 && show404ErrorPage || status === 403 && show403ErrorPage) {
231
+ if (status === 404 && show404ErrorPage || status === 403 && show403ErrorPage || status === 429 && show429ErrorPage) {
229
232
  var _error$request;
230
233
  var fullUrl = ((_error$request = error.request) === null || _error$request === void 0 ? void 0 : _error$request.responseURL) || error.config.url;
231
234
  useErrorDisplayStore.setState({
@@ -240,7 +243,7 @@ var handle404ErrorResponse = function handle404ErrorResponse(error) {
240
243
  var buildErrorResponseHandler = function buildErrorResponseHandler(skip) {
241
244
  var interceptors = [];
242
245
  if (!(skip !== null && skip !== void 0 && skip.transformCase)) interceptors.push(transformErrorKeysToCamelCase);
243
- if (!(skip !== null && skip !== void 0 && skip.show404ErrorPage)) interceptors.push(handle404ErrorResponse);
246
+ if (!(skip !== null && skip !== void 0 && skip.show404ErrorPage)) interceptors.push(handleErrorPageResponse);
244
247
  if (!(skip !== null && skip !== void 0 && skip.logoutOn401)) interceptors.push(handleUnauthorizedErrorResponse);
245
248
  if (!(skip !== null && skip !== void 0 && skip.showToastr)) interceptors.push(showErrorToastr);
246
249
  if (!(skip !== null && skip !== void 0 && skip.checkForReleaseVersionMismatch)) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/v2/initializers/axiosInitializer/index.js"],"sourcesContent":["import { Toastr } from \"@bigbinary/neeto-atoms\";\nimport axios from \"axios\";\nimport i18next from \"i18next\";\nimport {\n isNotEmpty,\n keysToCamelCase,\n matches,\n serializeKeysToSnakeCase,\n} from \"neetocist\";\nimport { dissoc, evolve, omit } from \"ramda\";\nimport { toast } from \"react-toastify\";\nimport { useErrorDisplayStore } from \"v2/react-utils/useDisplayErrorPage\";\nimport { resetAuthTokens } from \"v2/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 Toastr.success(\"👍\", { showIcon: false });\n } else if (matches({ noticeCode: \"thumbs_up\" }, response.data)) {\n Toastr.success(\"👍\", { showIcon: false });\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 checkForReleaseVersionMismatch = response => {\n const res = response?.response || response;\n const newReleaseVersion = Number(res?.headers?.[\"x-deploy-release-version\"]);\n const currentReleaseVersion = Number(globalProps?.deployReleaseVersion);\n\n if (\n newReleaseVersion &&\n currentReleaseVersion &&\n newReleaseVersion !== currentReleaseVersion\n ) {\n useErrorDisplayStore.setState({ showRefreshRibbon: true });\n }\n\n return response;\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?.checkForReleaseVersionMismatch) {\n interceptors.push(checkForReleaseVersionMismatch);\n }\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.noInternetConnection\")\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 if (status === 0) {\n toastrContent = i18next.t(\"neetoCommons.toastr.error.networkError\");\n shouldShowToastr = true;\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 if (!skip?.checkForReleaseVersionMismatch) {\n interceptors.push(checkForReleaseVersionMismatch);\n }\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"],"names":["checkOnlineInterval","requestErrorToasts","shouldNot","skip","_typeof","shouldShowToastr","response","isNotEmpty","notice","noticeCode","setAuthHeaders","_document$querySelect","axios","defaults","headers","_defineProperty","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","showIcon","pullDataFromResponse","_response$config$incl","includeMetadataInResponse","checkForReleaseVersionMismatch","_res$headers","_globalProps","res","newReleaseVersion","Number","currentReleaseVersion","globalProps","deployReleaseVersion","useErrorDisplayStore","setState","showRefreshRibbon","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","railsEnv","getUrlPathName","URL","_unused","handle404ErrorResponse","_error$config4","_error$response4","_ref5","_ref5$show404ErrorPag","show404ErrorPage","_ref5$show403ErrorPag","show403ErrorPage","_error$request","fullUrl","request","responseURL","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"],"mappings":";;;;;;;;;;;;;;;;AAkBA,IAAIA,mBAAmB,GAAG,IAAI;AAC9B,IAAIC,kBAAkB,GAAG,EAAE;AAE3B,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAGC,IAAI,EAAA;AAAA,EAAA,OAAIC,OAAA,CAAOD,IAAI,MAAK,QAAQ,IAAI,CAACA,IAAI;AAAA,CAAA;AAE3D,IAAME,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAGC,QAAQ,EAAA;AAAA,EAAA,OAC9B,OAAOA,QAAQ,KAAK,QAAQ,IAAIC,UAAU,CAACD,QAAQ,CAAC,IACpDF,OAAA,CAAOE,QAAQ,MAAK,QAAQ,KAAK,CAAAA,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAA,MAAA,GAAA,MAAA,GAARA,QAAQ,CAAEE,MAAM,MAAIF,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAA,MAAA,GAAA,MAAA,GAARA,QAAQ,CAAEG,UAAU,CAAA,CAAE;AAAA,CAAA;AAE9E,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,GAAS;AAAA,EAAA,IAAAC,qBAAA;AAC3B;EACAC,KAAK,CAACC,QAAQ,CAACC,OAAO,GAAAC,eAAA,CAAAA,eAAA,CAAAA,eAAA,KACnBC,YAAY,CAACC,MAAM,EAAG,kBAAkB,GACxCD,YAAY,CAACE,WAAW,EAAG,kBAAkB,GAC7CF,YAAY,CAACG,UAAU,EAAA,CAAAR,qBAAA,GAAGS,QAAQ,CAChCC,aAA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JA,IAAI,CAAEG,QAAQ,CAAC;AACxE,CAAC;AAEc,SAAS8J,eAAeA,CAACjK,IAAI,EAAE;AAC5C,EAAA,IAAI,EAACA,IAAI,KAAA,IAAA,IAAJA,IAAI,eAAJA,IAAI,CAAEkK,OAAO,CAAA,EAAEzJ,KAAK,CAACC,QAAQ,CAACwJ,OAAO,GAAG,GAAG;EAEhD,IAAI,EAAClK,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,IAAJA,IAAI,CAAEmK,WAAW,CAAA,EAAE5J,cAAc,EAAE;EAExC,IAAI,EAACP,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,IAAJA,IAAI,CAAEoK,gBAAgB,CAAA,EAAEC,mBAAmB,EAAE;EAElD,IAAItK,SAAS,CAACC,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJA,IAAI,CAAEwE,YAAY,CAAC,EAAEwF,kBAAkB,CAAChK,IAAI,KAAA,IAAA,IAAJA,IAAI,uBAAJA,IAAI,CAAEwE,YAAY,CAAC;AAC3E;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/v2/initializers/axiosInitializer/index.js"],"sourcesContent":["import { Toastr } from \"@bigbinary/neeto-atoms\";\nimport axios from \"axios\";\nimport i18next from \"i18next\";\nimport {\n isNotEmpty,\n keysToCamelCase,\n matches,\n serializeKeysToSnakeCase,\n} from \"neetocist\";\nimport { dissoc, evolve, omit } from \"ramda\";\nimport { toast } from \"react-toastify\";\nimport { useErrorDisplayStore } from \"v2/react-utils/useDisplayErrorPage\";\nimport { resetAuthTokens } from \"v2/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 Toastr.success(\"👍\", { showIcon: false });\n } else if (matches({ noticeCode: \"thumbs_up\" }, response.data)) {\n Toastr.success(\"👍\", { showIcon: false });\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 checkForReleaseVersionMismatch = response => {\n const res = response?.response || response;\n const newReleaseVersion = Number(res?.headers?.[\"x-deploy-release-version\"]);\n const currentReleaseVersion = Number(globalProps?.deployReleaseVersion);\n\n if (\n newReleaseVersion &&\n currentReleaseVersion &&\n newReleaseVersion !== currentReleaseVersion\n ) {\n useErrorDisplayStore.setState({ showRefreshRibbon: true });\n }\n\n return response;\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?.checkForReleaseVersionMismatch) {\n interceptors.push(checkForReleaseVersionMismatch);\n }\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 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.noInternetConnection\")\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 show429ErrorPage = 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 === 429 && show429ErrorPage) shouldShowToastr = false;\n\n if (status === 520) {\n shouldShowToastr = true;\n if (globalProps.railsEnv === \"production\") {\n toastrContent = i18next.t(\"generic.error\");\n }\n }\n\n if (status === 0) {\n toastrContent = i18next.t(\"neetoCommons.toastr.error.networkError\");\n shouldShowToastr = true;\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 handleErrorPageResponse = error => {\n const {\n show404ErrorPage = true,\n show403ErrorPage = true,\n show429ErrorPage = true,\n } = error.config ?? {};\n\n const status = error.response?.status;\n if (\n (status === 404 && show404ErrorPage) ||\n (status === 403 && show403ErrorPage) ||\n (status === 429 && show429ErrorPage)\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(handleErrorPageResponse);\n\n if (!skip?.logoutOn401) interceptors.push(handleUnauthorizedErrorResponse);\n\n if (!skip?.showToastr) interceptors.push(showErrorToastr);\n\n if (!skip?.checkForReleaseVersionMismatch) {\n interceptors.push(checkForReleaseVersionMismatch);\n }\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"],"names":["checkOnlineInterval","requestErrorToasts","shouldNot","skip","_typeof","shouldShowToastr","response","isNotEmpty","notice","noticeCode","setAuthHeaders","_document$querySelect","axios","defaults","headers","_defineProperty","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","showIcon","pullDataFromResponse","_response$config$incl","includeMetadataInResponse","checkForReleaseVersionMismatch","_res$headers","_globalProps","res","newReleaseVersion","Number","currentReleaseVersion","globalProps","deployReleaseVersion","useErrorDisplayStore","setState","showRefreshRibbon","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$show429ErrorPag","show429ErrorPage","_ref3$url","_ref3$method","_ref4","message","code","toastrContent","skippedStatusCodes","includes","isCancel","railsEnv","getUrlPathName","URL","_unused","handleErrorPageResponse","_error$config4","_error$response4","_ref5","_ref5$show404ErrorPag","show404ErrorPage","_ref5$show403ErrorPag","show403ErrorPage","_ref5$show429ErrorPag","_error$request","fullUrl","request","responseURL","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"],"mappings":";;;;;;;;;;;;;;;;AAkBA,IAAIA,mBAAmB,GAAG,IAAI;AAC9B,IAAIC,kBAAkB,GAAG,EAAE;AAE3B,IAAMC,SAAS,GAAG,SAAZA,SAASA,CAAGC,IAAI,EAAA;AAAA,EAAA,OAAIC,OAAA,CAAOD,IAAI,MAAK,QAAQ,IAAI,CAACA,IAAI;AAAA,CAAA;AAE3D,IAAME,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAGC,QAAQ,EAAA;AAAA,EAAA,OAC9B,OAAOA,QAAQ,KAAK,QAAQ,IAAIC,UAAU,CAACD,QAAQ,CAAC,IACpDF,OAAA,CAAOE,QAAQ,MAAK,QAAQ,KAAK,CAAAA,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAA,MAAA,GAAA,MAAA,GAARA,QAAQ,CAAEE,MAAM,MAAIF,QAAQ,KAAA,IAAA,IAARA,QAAQ,KAAA,MAAA,GAAA,MAAA,GAARA,QAAQ,CAAEG,UAAU,CAAA,CAAE;AAAA,CAAA;AAE9E,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,GAAS;AAAA,EAAA,IAAAC,qBAAA;AAC3B;EACAC,KAAK,CAACC,QAAQ,CAACC,OAAO,GAAAC,eAAA,CAAAA,eAAA,CAAAA,eAAA,KACnBC,YAAY,CAACC,MAAM,EAAG,kBAAkB,GACxCD,YAAY,CAACE,WAAW,EAAG,kBAAkB,GAC7CF,YAAY,CAACG,UAAU,EAAA,CAAAR,qBAAA,GAAGS,QAAQ,CAChCC,aAAa,CAAC,qBAAqB,CAAC,MAAA,IAAA,IAAAV,qBAAA,uBADZA,qBAAA,CAEvBW,YAAY,CAAC,SAAS,CAAC,CAC5B;AACH,CAAC;;AAED;AACA;AACA,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAGC,SAAS,EAAA;AAAA,EAAA,OAAI,UAAAC,IA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AAS,CAACC,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJA,IAAI,CAAEG,QAAQ,CAAC,EAAE+J,uBAAuB,CAAClK,IAAI,KAAA,IAAA,IAAJA,IAAI,uBAAJA,IAAI,CAAEG,QAAQ,CAAC;AACxE,CAAC;AAEc,SAASiK,eAAeA,CAACpK,IAAI,EAAE;AAC5C,EAAA,IAAI,EAACA,IAAI,KAAA,IAAA,IAAJA,IAAI,eAAJA,IAAI,CAAEqK,OAAO,CAAA,EAAE5J,KAAK,CAACC,QAAQ,CAAC2J,OAAO,GAAG,GAAG;EAEhD,IAAI,EAACrK,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,IAAJA,IAAI,CAAEsK,WAAW,CAAA,EAAE/J,cAAc,EAAE;EAExC,IAAI,EAACP,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,IAAJA,IAAI,CAAEuK,gBAAgB,CAAA,EAAEC,mBAAmB,EAAE;EAElD,IAAIzK,SAAS,CAACC,IAAI,KAAA,IAAA,IAAJA,IAAI,KAAA,MAAA,GAAA,MAAA,GAAJA,IAAI,CAAEwE,YAAY,CAAC,EAAE2F,kBAAkB,CAACnK,IAAI,KAAA,IAAA,IAAJA,IAAI,uBAAJA,IAAI,CAAEwE,YAAY,CAAC;AAC3E;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigbinary/neeto-commons-frontend",
3
- "version": "4.13.165",
3
+ "version": "4.13.166-beta1",
4
4
  "description": "A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.",
5
5
  "repository": "git@github.com:bigbinary/neeto-commons-frontend.git",
6
6
  "author": "Amaljith K <amaljith.k@bigbinary.com>",