@bigbinary/neeto-commons-frontend 3.0.7 → 3.0.10
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/cjs/configs/babel.js +50 -0
- package/cjs/configs/eslint/globals.js +14 -0
- package/cjs/configs/eslint/helpers/index.js +74 -0
- package/cjs/configs/eslint/imports/enforced.js +29 -0
- package/cjs/configs/eslint/imports/order.js +65 -0
- package/cjs/configs/eslint/index.js +171 -0
- package/cjs/configs/eslint/overrides.js +26 -0
- package/cjs/configs/eslint/promise.js +8 -0
- package/cjs/configs/eslint/react.js +92 -0
- package/cjs/configs/nanos/eslint/imports/order.js +25 -0
- package/cjs/configs/nanos/eslint/index.js +28 -0
- package/cjs/configs/nanos/tailwind.js +11 -0
- package/cjs/configs/nanos/webpack/resolve.js +48 -0
- package/cjs/configs/nextjs/eslint/imports/order.js +25 -0
- package/cjs/configs/nextjs/eslint/index.js +22 -0
- package/cjs/configs/nextjs/webpack/resolve.js +1 -0
- package/cjs/configs/prettier.js +16 -0
- package/cjs/configs/scripts/dead-code-eliminator/constants.js +12 -0
- package/cjs/configs/scripts/dead-code-eliminator/index.js +266 -0
- package/cjs/configs/scripts/getPkgTranslations.js +45 -0
- package/cjs/configs/scripts/jsdoc-builder/constants.mjs +42 -0
- package/cjs/configs/scripts/jsdoc-builder/index.mjs +67 -0
- package/cjs/configs/scripts/jsdoc-builder/utils.mjs +219 -0
- package/cjs/configs/scripts/remove-unused-translation-keys/constants.js +11 -0
- package/cjs/configs/scripts/remove-unused-translation-keys/index.js +186 -0
- package/cjs/configs/tailwind.js +13 -0
- package/cjs/configs/webpack/helpers/customize-default-rules.js +54 -0
- package/cjs/configs/webpack/index.js +59 -0
- package/cjs/configs/webpack/resolve.js +53 -0
- package/cjs/configs/webpack/rules.js +34 -0
- package/cjs/cypress-configs/initializer.js +32 -0
- package/cjs/cypress-configs/plugins.js +105 -0
- package/cjs/cypress-configs/resolve.js +17 -0
- package/cjs/cypress-configs/webpack.config.js +19 -0
- package/cjs/initializers/axios/index.js +1 -2
- package/cjs/initializers/axios/index.js.map +1 -1
- package/cjs/initializers/constants.js +9 -3
- package/cjs/initializers/constants.js.map +1 -1
- package/cjs/initializers/i18n.js +8 -2
- package/cjs/initializers/i18n.js.map +1 -1
- package/cjs/initializers/utils/customFormatters.js +17 -8
- package/cjs/initializers/utils/customFormatters.js.map +1 -1
- package/cjs/translations/en.json +100 -0
- package/configs/eslint/overrides.js +3 -7
- package/configs/webpack/index.js +1 -0
- package/initializers/axios/index.js +2 -3
- package/initializers/axios/index.js.map +1 -1
- package/initializers/constants.js +6 -1
- package/initializers/constants.js.map +1 -1
- package/initializers/i18n.js +9 -3
- package/initializers/i18n.js.map +1 -1
- package/initializers/utils/customFormatters.js +16 -7
- package/initializers/utils/customFormatters.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/// <reference types="cypress" />
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @type {Cypress.PluginConfig}
|
|
6
|
+
*/
|
|
7
|
+
// eslint-disable-next-line no-unused-vars
|
|
8
|
+
const path = require("path");
|
|
9
|
+
|
|
10
|
+
const webpack = require("@cypress/webpack-preprocessor");
|
|
11
|
+
const {
|
|
12
|
+
cypressBrowserPermissionsPlugin,
|
|
13
|
+
} = require("cypress-browser-permissions");
|
|
14
|
+
const { cloudPlugin } = require("cypress-cloud/plugin");
|
|
15
|
+
const fs = require("fs-extra");
|
|
16
|
+
|
|
17
|
+
const getConfigurationByFile = file => {
|
|
18
|
+
const pathToConfigFile = `cypress/config/cypress.${file}.json`;
|
|
19
|
+
|
|
20
|
+
return file && fs.readJsonSync(path.join(process.cwd(), pathToConfigFile));
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
const globalState = "globalState.txt";
|
|
24
|
+
|
|
25
|
+
const merge = (target, source = {}) => {
|
|
26
|
+
Object.keys(source).forEach(key => {
|
|
27
|
+
if (source[key] && typeof source[key] === "object") {
|
|
28
|
+
merge((target[key] = target[key] || {}), source[key]);
|
|
29
|
+
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
target[key] = source[key];
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
module.exports = (on, config) => {
|
|
39
|
+
const environment = config.env.configFile;
|
|
40
|
+
const configForEnvironment = getConfigurationByFile(environment);
|
|
41
|
+
const options = {
|
|
42
|
+
// send in the options from your webpack.config.js
|
|
43
|
+
webpackOptions: require("./webpack.config"),
|
|
44
|
+
watchOptions: {},
|
|
45
|
+
};
|
|
46
|
+
on("file:preprocessor", webpack(options));
|
|
47
|
+
|
|
48
|
+
config = cypressBrowserPermissionsPlugin(on, config);
|
|
49
|
+
|
|
50
|
+
const newEnvironment = merge(config, configForEnvironment);
|
|
51
|
+
require("@cypress/grep/src/plugin")(newEnvironment);
|
|
52
|
+
require("@cypress/code-coverage/task")(on, newEnvironment);
|
|
53
|
+
cloudPlugin(on, newEnvironment);
|
|
54
|
+
|
|
55
|
+
on("before:browser:launch", (browser, launchOptions) => {
|
|
56
|
+
if (["chrome", "edge"].includes(browser.name) && browser.isHeadless) {
|
|
57
|
+
launchOptions.args.push("--no-sandbox");
|
|
58
|
+
launchOptions.args.push("--disable-gl-drawing-for-tests");
|
|
59
|
+
launchOptions.args.push("--js-flags=--max-old-space-size=3500");
|
|
60
|
+
launchOptions.args.push("--disable-gpu");
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return launchOptions;
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const readFileSyncIfExists = filePath => {
|
|
67
|
+
try {
|
|
68
|
+
return JSON.parse(fs.readFileSync(filePath, "utf8"));
|
|
69
|
+
} catch (error) {
|
|
70
|
+
if (error.code === "ENOENT") {
|
|
71
|
+
return {};
|
|
72
|
+
}
|
|
73
|
+
console.log(error); // eslint-disable-line
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return {};
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const writeDataToFile = (filePath, data) => {
|
|
80
|
+
try {
|
|
81
|
+
fs.writeFileSync(filePath, data, "utf8");
|
|
82
|
+
} catch (err) {
|
|
83
|
+
console.log(err); // eslint-disable-line
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return true;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
on("task", {
|
|
90
|
+
getGlobalState: key =>
|
|
91
|
+
key
|
|
92
|
+
? readFileSyncIfExists(globalState)?.[key] ?? null
|
|
93
|
+
: readFileSyncIfExists(globalState),
|
|
94
|
+
updateGlobalState: ({ key, value }) => {
|
|
95
|
+
const data = readFileSyncIfExists(globalState);
|
|
96
|
+
data[key] = value;
|
|
97
|
+
|
|
98
|
+
return writeDataToFile(globalState, JSON.stringify(data));
|
|
99
|
+
},
|
|
100
|
+
bulkUpdateGlobalState: newState =>
|
|
101
|
+
writeDataToFile(globalState, JSON.stringify(newState)),
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
return config, newEnvironment;
|
|
105
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const path = require("path");
|
|
2
|
+
|
|
3
|
+
const basePath = `${process.cwd()}/cypress/`;
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
alias: {
|
|
7
|
+
Fixtures: path.resolve(basePath, "fixtures"),
|
|
8
|
+
Plugins: path.resolve(basePath, "plugins"),
|
|
9
|
+
Support: path.resolve(basePath, "support"),
|
|
10
|
+
Texts: path.resolve(basePath, "constants/texts"),
|
|
11
|
+
Selectors: path.resolve(basePath, "constants/selectors"),
|
|
12
|
+
neetocommons: "@bigbinary/neeto-commons-frontend",
|
|
13
|
+
Constants: path.resolve(basePath, "constants"),
|
|
14
|
+
neetocist: "@bigbinary/neeto-cist",
|
|
15
|
+
},
|
|
16
|
+
fallback: { path: require.resolve("path-browserify") },
|
|
17
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const resolve = require("./resolve");
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
resolve,
|
|
5
|
+
module: {
|
|
6
|
+
rules: [
|
|
7
|
+
{
|
|
8
|
+
test: /\.(js|jsx)$/,
|
|
9
|
+
exclude: [/node_modules/],
|
|
10
|
+
use: [
|
|
11
|
+
{
|
|
12
|
+
loader: "babel-loader",
|
|
13
|
+
options: { presets: ["@babel/preset-env"] },
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -102,7 +102,6 @@ var handleUnauthorizedErrorResponse = function handleUnauthorizedErrorResponse(e
|
|
|
102
102
|
if (redirectOnError) {
|
|
103
103
|
setTimeout(function () {
|
|
104
104
|
var redirectTo = window.location.pathname === "/login" ? "/login" : "/login?redirect_uri=".concat(encodeURIComponent(window.location.href));
|
|
105
|
-
// eslint-disable-next-line xss/no-location-href-assign
|
|
106
105
|
window.location.href = redirectTo;
|
|
107
106
|
}, 300);
|
|
108
107
|
}
|
|
@@ -163,7 +162,7 @@ var cleanupCredentialsForCrossOrigin = function cleanupCredentialsForCrossOrigin
|
|
|
163
162
|
if (!request.url.includes("://")) return request;
|
|
164
163
|
if (request.url.includes(window.location.hostname)) return request;
|
|
165
164
|
return (0, _ramda.evolve)({
|
|
166
|
-
headers: (0, _ramda.omit)(
|
|
165
|
+
headers: (0, _ramda.omit)([_constants.HEADERS_KEYS.xCsrfToken])
|
|
167
166
|
})(request);
|
|
168
167
|
};
|
|
169
168
|
var transformDataToSnakeCase = function transformDataToSnakeCase(request) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_axios","_interopRequireDefault","require","_i18next","_neetoCist","_reactUtils","_utils","_neetoui","_ramda","_paramsSerializer","_constants","shouldNot","skip","_typeof2","shouldShowToastr","response","notice","noticeCode","setAuthHeaders","_document$querySelect","_axios$defaults$heade","axios","defaults","headers","_defineProperty2","HEADERS_KEYS","accept","contentType","xCsrfToken","document","querySelector","getAttribute","createPipe","functions","data","reduce","acc","fn","transformResponseKeysToCamelCase","_response$config$tran","config","transformResponseCase","keysToCamelCase","transformErrorKeysToCamelCase","error","_error$config","_error$response","_ref","_ref$transformRespons","showSuccessToastr","_response$config$show","showToastr","matches","showThumbsUpToastr","Toastr","success","icon","className","pullDataFromResponse","_response$config$incl","includeMetadataInResponse","buildSuccessResponseHandler","interceptors","transformCase","push","handleUnauthorizedErrorResponse","_error$response2","_error$config2","status","resetAuthTokens","_ref2","_ref2$redirectOnError","redirectOnError","setTimeout","redirectTo","window","location","pathname","concat","encodeURIComponent","href","showErrorToastr","_error$config3","_error$response3","_ref3","_ref3$showToastr","message","i18next","t","includes","isCancel","getUrlPathName","url","URL","_unused","handle404ErrorResponse","_error$config4","_error$response4","_ref4","_ref4$show404ErrorPag","show404ErrorPage","_ref4$show403ErrorPag","show403ErrorPage","_error$request","fullUrl","request","responseURL","useErrorDisplayStore","setState","showErrorPage","statusCode","failedApiUrl","failedApiPath","buildErrorResponseHandler","logoutOn401","Promise","reject","bind","cleanupCredentialsForCrossOrigin","hostname","evolve","omit","values","transformDataToSnakeCase","_request$transformReq","transformRequestCase","serializeKeysToSnakeCase","params","addRequestInterceptors","cleanCredentialsForCrossOrigin","use","addResponseInterceptors","registerIntercepts","initializeAxios","baseURL","authHeaders","paramsSerializer","setParamsSerializer"],"sources":["../../../../src/initializers/axios/index.js"],"sourcesContent":["import axios from \"axios\";\nimport i18next from \"i18next\";\nimport { keysToCamelCase, matches, serializeKeysToSnakeCase } from \"neetocist\";\nimport { useErrorDisplayStore } from \"neetocommons/react-utils\";\nimport { resetAuthTokens } from \"neetocommons/utils\";\nimport { Toastr } from \"neetoui\";\nimport { evolve, omit, values } from \"ramda\";\n\nimport setParamsSerializer from \"./paramsSerializer\";\n\nimport { HEADERS_KEYS } from \"../constants\";\n\nconst shouldNot = skip => typeof skip === \"object\" || !skip;\n\nconst shouldShowToastr = response =>\n typeof response === \"string\" ||\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 { showToastr = true } = response.config;\n if (!showToastr) return response;\n\n if (matches({ showThumbsUpToastr: true }, response.data)) {\n // @ts-ignore\n Toastr.success(\"\", { icon: \"👍\", className: \"w-20\" });\n } else if (matches({ noticeCode: \"thumbs_up\" }, response.data)) {\n // @ts-ignore\n Toastr.success(\"\", { icon: \"👍\", className: \"w-20\" });\n } else if (shouldShowToastr(response.data)) {\n Toastr.success(response.data);\n }\n\n return response;\n};\n\nconst pullDataFromResponse = response => {\n const { includeMetadataInResponse = false } = response.config;\n\n return includeMetadataInResponse ? response : response.data;\n};\n\nconst buildSuccessResponseHandler = skip => {\n const interceptors = [];\n if (!skip?.transformCase) interceptors.push(transformResponseKeysToCamelCase);\n\n if (!skip?.showToastr) interceptors.push(showSuccessToastr);\n\n if (!skip?.pullDataFromResponse) interceptors.push(pullDataFromResponse);\n\n return createPipe(interceptors);\n};\n\nconst handleUnauthorizedErrorResponse = error => {\n if (error.response?.status !== 401) return error;\n\n resetAuthTokens();\n\n const { redirectOnError = true } = error.config ?? {};\n if (redirectOnError) {\n setTimeout(() => {\n const redirectTo =\n window.location.pathname === \"/login\"\n ? \"/login\"\n : `/login?redirect_uri=${encodeURIComponent(window.location.href)}`;\n // eslint-disable-next-line xss/no-location-href-assign\n window.location.href = redirectTo;\n }, 300);\n }\n\n return error;\n};\n\nconst showErrorToastr = error => {\n const { showToastr = true } = error.config ?? {};\n if (!showToastr) return error;\n\n if (error.message === \"Network Error\") {\n // @ts-ignore\n Toastr.error(i18next.t(\"neetoCommons.toastr.error.networkError\"));\n } else if (\n ![403, 404].includes(error.response?.status) &&\n !axios.isCancel(error)\n ) {\n // we already display a page in case of 403 & 404 and we don't want to show a toastr for cancelled requests.\n Toastr.error(error);\n }\n\n return error;\n};\n\nconst getUrlPathName = url => {\n try {\n return new URL(url).pathname;\n } catch {\n return url;\n }\n};\n\nconst handle404ErrorResponse = error => {\n const { show404ErrorPage = true, show403ErrorPage = true } =\n error.config ?? {};\n\n const status = error.response?.status;\n if (\n (status === 404 && show404ErrorPage) ||\n (status === 403 && show403ErrorPage)\n ) {\n const fullUrl = error.request?.responseURL || error.config.url;\n useErrorDisplayStore.setState({\n showErrorPage: true,\n statusCode: status,\n failedApiUrl: fullUrl,\n failedApiPath: getUrlPathName(fullUrl),\n });\n }\n\n return error;\n};\n\nconst buildErrorResponseHandler = skip => {\n const interceptors = [];\n if (!skip?.transformCase) interceptors.push(transformErrorKeysToCamelCase);\n\n if (!skip?.show404ErrorPage) interceptors.push(handle404ErrorResponse);\n\n if (!skip?.logoutOn401) interceptors.push(handleUnauthorizedErrorResponse);\n\n if (!skip?.showToastr) interceptors.push(showErrorToastr);\n\n interceptors.push(Promise.reject.bind(Promise));\n\n return createPipe(interceptors);\n};\n\nconst cleanupCredentialsForCrossOrigin = request => {\n if (!request.url.includes(\"://\")) return request;\n\n if (request.url.includes(window.location.hostname)) return request;\n\n return evolve({ headers: omit(values(HEADERS_KEYS)) })(request);\n};\n\nconst transformDataToSnakeCase = request => {\n const { transformRequestCase = true } = request;\n\n if (!transformRequestCase) return request;\n\n return evolve(\n { data: serializeKeysToSnakeCase, params: serializeKeysToSnakeCase },\n request\n );\n};\n\nconst addRequestInterceptors = skip => {\n if (!skip?.cleanCredentialsForCrossOrigin) {\n axios.interceptors.request.use(cleanupCredentialsForCrossOrigin);\n }\n\n if (!skip?.transformCase) {\n axios.interceptors.request.use(transformDataToSnakeCase);\n }\n};\n\nconst addResponseInterceptors = skip => {\n axios.interceptors.response.use(\n buildSuccessResponseHandler(skip),\n buildErrorResponseHandler(skip)\n );\n};\n\nconst registerIntercepts = skip => {\n if (shouldNot(skip?.request)) addRequestInterceptors(skip?.request);\n\n if (shouldNot(skip?.response)) addResponseInterceptors(skip?.response);\n};\n\nexport default function initializeAxios(skip) {\n if (!skip?.baseURL) axios.defaults.baseURL = \"/\";\n\n if (!skip?.authHeaders) setAuthHeaders();\n\n if (!skip?.paramsSerializer) setParamsSerializer();\n\n if (shouldNot(skip?.interceptors)) registerIntercepts(skip?.interceptors);\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAEA,IAAAO,iBAAA,GAAAR,sBAAA,CAAAC,OAAA;AAEA,IAAAQ,UAAA,GAAAR,OAAA;AAEA,IAAMS,SAAS,GAAG,SAAZA,SAASA,CAAGC,IAAI;EAAA,OAAI,IAAAC,QAAA,aAAOD,IAAI,MAAK,QAAQ,IAAI,CAACA,IAAI;AAAA;AAE3D,IAAME,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAGC,QAAQ;EAAA,OAC/B,OAAO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AS,CAACC,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEG,QAAQ,CAAC,EAAEoH,uBAAuB,CAACvH,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEG,QAAQ,CAAC;AACxE,CAAC;AAEc,SAASsH,eAAeA,CAACzH,IAAI,EAAE;EAC5C,IAAI,EAACA,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAE0H,OAAO,GAAEjH,iBAAK,CAACC,QAAQ,CAACgH,OAAO,GAAG,GAAG;EAEhD,IAAI,EAAC1H,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAE2H,WAAW,GAAErH,cAAc,EAAE;EAExC,IAAI,EAACN,IAAI,aAAJA,IAAI,eAAJA,IAAI,CAAE4H,gBAAgB,GAAE,IAAAC,4BAAmB,GAAE;EAElD,IAAI9H,SAAS,CAACC,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEkD,YAAY,CAAC,EAAEsE,kBAAkB,CAACxH,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEkD,YAAY,CAAC;AAC3E"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_axios","_interopRequireDefault","require","_i18next","_neetoCist","_reactUtils","_utils","_neetoui","_ramda","_paramsSerializer","_constants","shouldNot","skip","_typeof2","shouldShowToastr","response","notice","noticeCode","setAuthHeaders","_document$querySelect","_axios$defaults$heade","axios","defaults","headers","_defineProperty2","HEADERS_KEYS","accept","contentType","xCsrfToken","document","querySelector","getAttribute","createPipe","functions","data","reduce","acc","fn","transformResponseKeysToCamelCase","_response$config$tran","config","transformResponseCase","keysToCamelCase","transformErrorKeysToCamelCase","error","_error$config","_error$response","_ref","_ref$transformRespons","showSuccessToastr","_response$config$show","showToastr","matches","showThumbsUpToastr","Toastr","success","icon","className","pullDataFromResponse","_response$config$incl","includeMetadataInResponse","buildSuccessResponseHandler","interceptors","transformCase","push","handleUnauthorizedErrorResponse","_error$response2","_error$config2","status","resetAuthTokens","_ref2","_ref2$redirectOnError","redirectOnError","setTimeout","redirectTo","window","location","pathname","concat","encodeURIComponent","href","showErrorToastr","_error$config3","_error$response3","_ref3","_ref3$showToastr","message","i18next","t","includes","isCancel","getUrlPathName","url","URL","_unused","handle404ErrorResponse","_error$config4","_error$response4","_ref4","_ref4$show404ErrorPag","show404ErrorPage","_ref4$show403ErrorPag","show403ErrorPage","_error$request","fullUrl","request","responseURL","useErrorDisplayStore","setState","showErrorPage","statusCode","failedApiUrl","failedApiPath","buildErrorResponseHandler","logoutOn401","Promise","reject","bind","cleanupCredentialsForCrossOrigin","hostname","evolve","omit","transformDataToSnakeCase","_request$transformReq","transformRequestCase","serializeKeysToSnakeCase","params","addRequestInterceptors","cleanCredentialsForCrossOrigin","use","addResponseInterceptors","registerIntercepts","initializeAxios","baseURL","authHeaders","paramsSerializer","setParamsSerializer"],"sources":["../../../../src/initializers/axios/index.js"],"sourcesContent":["import axios from \"axios\";\nimport i18next from \"i18next\";\nimport { keysToCamelCase, matches, serializeKeysToSnakeCase } from \"neetocist\";\nimport { useErrorDisplayStore } from \"neetocommons/react-utils\";\nimport { resetAuthTokens } from \"neetocommons/utils\";\nimport { Toastr } from \"neetoui\";\nimport { evolve, omit } from \"ramda\";\n\nimport setParamsSerializer from \"./paramsSerializer\";\n\nimport { HEADERS_KEYS } from \"../constants\";\n\nconst shouldNot = skip => typeof skip === \"object\" || !skip;\n\nconst shouldShowToastr = response =>\n typeof response === \"string\" ||\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 { showToastr = true } = response.config;\n if (!showToastr) return response;\n\n if (matches({ showThumbsUpToastr: true }, response.data)) {\n // @ts-ignore\n Toastr.success(\"\", { icon: \"👍\", className: \"w-20\" });\n } else if (matches({ noticeCode: \"thumbs_up\" }, response.data)) {\n // @ts-ignore\n Toastr.success(\"\", { icon: \"👍\", className: \"w-20\" });\n } else if (shouldShowToastr(response.data)) {\n Toastr.success(response.data);\n }\n\n return response;\n};\n\nconst pullDataFromResponse = response => {\n const { includeMetadataInResponse = false } = response.config;\n\n return includeMetadataInResponse ? response : response.data;\n};\n\nconst buildSuccessResponseHandler = skip => {\n const interceptors = [];\n if (!skip?.transformCase) interceptors.push(transformResponseKeysToCamelCase);\n\n if (!skip?.showToastr) interceptors.push(showSuccessToastr);\n\n if (!skip?.pullDataFromResponse) interceptors.push(pullDataFromResponse);\n\n return createPipe(interceptors);\n};\n\nconst handleUnauthorizedErrorResponse = error => {\n if (error.response?.status !== 401) return error;\n\n resetAuthTokens();\n\n const { redirectOnError = true } = error.config ?? {};\n if (redirectOnError) {\n setTimeout(() => {\n const redirectTo =\n window.location.pathname === \"/login\"\n ? \"/login\"\n : `/login?redirect_uri=${encodeURIComponent(window.location.href)}`;\n\n window.location.href = redirectTo;\n }, 300);\n }\n\n return error;\n};\n\nconst showErrorToastr = error => {\n const { showToastr = true } = error.config ?? {};\n if (!showToastr) return error;\n\n if (error.message === \"Network Error\") {\n // @ts-ignore\n Toastr.error(i18next.t(\"neetoCommons.toastr.error.networkError\"));\n } else if (\n ![403, 404].includes(error.response?.status) &&\n !axios.isCancel(error)\n ) {\n // we already display a page in case of 403 & 404 and we don't want to show a toastr for cancelled requests.\n Toastr.error(error);\n }\n\n return error;\n};\n\nconst getUrlPathName = url => {\n try {\n return new URL(url).pathname;\n } catch {\n return url;\n }\n};\n\nconst handle404ErrorResponse = error => {\n const { show404ErrorPage = true, show403ErrorPage = true } =\n error.config ?? {};\n\n const status = error.response?.status;\n if (\n (status === 404 && show404ErrorPage) ||\n (status === 403 && show403ErrorPage)\n ) {\n const fullUrl = error.request?.responseURL || error.config.url;\n useErrorDisplayStore.setState({\n showErrorPage: true,\n statusCode: status,\n failedApiUrl: fullUrl,\n failedApiPath: getUrlPathName(fullUrl),\n });\n }\n\n return error;\n};\n\nconst buildErrorResponseHandler = skip => {\n const interceptors = [];\n if (!skip?.transformCase) interceptors.push(transformErrorKeysToCamelCase);\n\n if (!skip?.show404ErrorPage) interceptors.push(handle404ErrorResponse);\n\n if (!skip?.logoutOn401) interceptors.push(handleUnauthorizedErrorResponse);\n\n if (!skip?.showToastr) interceptors.push(showErrorToastr);\n\n interceptors.push(Promise.reject.bind(Promise));\n\n return createPipe(interceptors);\n};\n\nconst cleanupCredentialsForCrossOrigin = request => {\n if (!request.url.includes(\"://\")) return request;\n\n if (request.url.includes(window.location.hostname)) return request;\n\n return evolve({ headers: omit([HEADERS_KEYS.xCsrfToken]) })(request);\n};\n\nconst transformDataToSnakeCase = request => {\n const { transformRequestCase = true } = request;\n\n if (!transformRequestCase) return request;\n\n return evolve(\n { data: serializeKeysToSnakeCase, params: serializeKeysToSnakeCase },\n request\n );\n};\n\nconst addRequestInterceptors = skip => {\n if (!skip?.cleanCredentialsForCrossOrigin) {\n axios.interceptors.request.use(cleanupCredentialsForCrossOrigin);\n }\n\n if (!skip?.transformCase) {\n axios.interceptors.request.use(transformDataToSnakeCase);\n }\n};\n\nconst addResponseInterceptors = skip => {\n axios.interceptors.response.use(\n buildSuccessResponseHandler(skip),\n buildErrorResponseHandler(skip)\n );\n};\n\nconst registerIntercepts = skip => {\n if (shouldNot(skip?.request)) addRequestInterceptors(skip?.request);\n\n if (shouldNot(skip?.response)) addResponseInterceptors(skip?.response);\n};\n\nexport default function initializeAxios(skip) {\n if (!skip?.baseURL) axios.defaults.baseURL = \"/\";\n\n if (!skip?.authHeaders) setAuthHeaders();\n\n if (!skip?.paramsSerializer) setParamsSerializer();\n\n if (shouldNot(skip?.interceptors)) registerIntercepts(skip?.interceptors);\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AAEA,IAAAO,iBAAA,GAAAR,sBAAA,CAAAC,OAAA;AAEA,IAAAQ,UAAA,GAAAR,OAAA;AAEA,IAAMS,SAAS,GAAG,SAAZA,SAASA,CAAGC,IAAI;EAAA,OAAI,IAAAC,QAAA,aAAOD,IAAI,MAAK,QAAQ,IAAI,CAACA,IAAI;AAAA;AAE3D,IAAME,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAGC,QAAQ;EAAA,OAC/B,OAAOA,QAAQ,KAAK,QAAQ,IAC3B,IAAAF,QAAA,aAAOE,QAAQ,MAAK,QAAQ,KAAK,CAAAA,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEC,MAAM,MAAID,QAAQ,aAARA,QAAQ,uBAARA,QAAQ,CAAEE,UAAU,EAAE;AAAA;AAE9E,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAA,EAAS;EAAA,IAAAC,qBAAA,EAAAC,qBAAA;EAC3B;EACAC,iBAAK,CAACC,QAAQ,CAACC,OAAO,IAAAH,qBAAA,WAAAI,gBAAA,aAAAJ,qBAAA,EACnBK,uBAAY,CAACC,MAAM,EAAG,kBAAkB,OAAAF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AJA,IAAI,eAAJA,IAAI,CAAE2H,gBAAgB,GAAE,IAAAC,4BAAmB,GAAE;EAElD,IAAI7H,SAAS,CAACC,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEkD,YAAY,CAAC,EAAEqE,kBAAkB,CAACvH,IAAI,aAAJA,IAAI,uBAAJA,IAAI,CAAEkD,YAAY,CAAC;AAC3E"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.LOWERCASED = exports.HEADERS_KEYS = exports.
|
|
6
|
+
exports.LOWERCASED = exports.LIST_FORMATS = exports.HEADERS_KEYS = exports.FORMATS = void 0;
|
|
7
7
|
var HEADERS_KEYS = {
|
|
8
8
|
xCsrfToken: "X-CSRF-TOKEN",
|
|
9
9
|
contentType: "Content-Type",
|
|
@@ -12,6 +12,12 @@ var HEADERS_KEYS = {
|
|
|
12
12
|
exports.HEADERS_KEYS = HEADERS_KEYS;
|
|
13
13
|
var LOWERCASED = "__LOWERCASED__";
|
|
14
14
|
exports.LOWERCASED = LOWERCASED;
|
|
15
|
-
var
|
|
16
|
-
|
|
15
|
+
var FORMATS = {
|
|
16
|
+
boldList: "boldList",
|
|
17
|
+
list: "list",
|
|
18
|
+
anyCase: "anyCase"
|
|
19
|
+
};
|
|
20
|
+
exports.FORMATS = FORMATS;
|
|
21
|
+
var LIST_FORMATS = [FORMATS.boldList, FORMATS.list];
|
|
22
|
+
exports.LIST_FORMATS = LIST_FORMATS;
|
|
17
23
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","names":["HEADERS_KEYS","xCsrfToken","contentType","accept","exports","LOWERCASED","
|
|
1
|
+
{"version":3,"file":"constants.js","names":["HEADERS_KEYS","xCsrfToken","contentType","accept","exports","LOWERCASED","FORMATS","boldList","list","anyCase","LIST_FORMATS"],"sources":["../../../src/initializers/constants.js"],"sourcesContent":["export const HEADERS_KEYS = {\n xCsrfToken: \"X-CSRF-TOKEN\",\n contentType: \"Content-Type\",\n accept: \"Accept\",\n};\n\nexport const LOWERCASED = \"__LOWERCASED__\";\n\nexport const FORMATS = {\n boldList: \"boldList\",\n list: \"list\",\n anyCase: \"anyCase\",\n};\nexport const LIST_FORMATS = [FORMATS.boldList, FORMATS.list];\n"],"mappings":";;;;;;AAAO,IAAMA,YAAY,GAAG;EAC1BC,UAAU,EAAE,cAAc;EAC1BC,WAAW,EAAE,cAAc;EAC3BC,MAAM,EAAE;AACV,CAAC;AAACC,OAAA,CAAAJ,YAAA,GAAAA,YAAA;AAEK,IAAMK,UAAU,GAAG,gBAAgB;AAACD,OAAA,CAAAC,UAAA,GAAAA,UAAA;AAEpC,IAAMC,OAAO,GAAG;EACrBC,QAAQ,EAAE,UAAU;EACpBC,IAAI,EAAE,MAAM;EACZC,OAAO,EAAE;AACX,CAAC;AAACL,OAAA,CAAAE,OAAA,GAAAA,OAAA;AACK,IAAMI,YAAY,GAAG,CAACJ,OAAO,CAACC,QAAQ,EAAED,OAAO,CAACE,IAAI,CAAC;AAACJ,OAAA,CAAAM,YAAA,GAAAA,YAAA"}
|
package/cjs/initializers/i18n.js
CHANGED
|
@@ -9,6 +9,7 @@ var _i18next = _interopRequireDefault(require("i18next"));
|
|
|
9
9
|
var _i18nextBrowserLanguagedetector = _interopRequireDefault(require("i18next-browser-languagedetector"));
|
|
10
10
|
var _ramda = require("ramda");
|
|
11
11
|
var _reactI18next = require("react-i18next");
|
|
12
|
+
var _constants = require("./constants");
|
|
12
13
|
var _utils = require("./utils");
|
|
13
14
|
var _customFormatters = require("./utils/customFormatters");
|
|
14
15
|
var _customPostProcessors = require("./utils/customPostProcessors");
|
|
@@ -47,8 +48,13 @@ var initializeI18n = function initializeI18n(hostTranslations) {
|
|
|
47
48
|
alwaysFormat: true,
|
|
48
49
|
format: function format(value, _format, lng, options) {
|
|
49
50
|
var newValue = value;
|
|
50
|
-
if (_format
|
|
51
|
-
newValue = (0, _customFormatters.
|
|
51
|
+
if (_constants.LIST_FORMATS.includes(_format)) {
|
|
52
|
+
newValue = (0, _customFormatters.listFormatter)({
|
|
53
|
+
value: newValue,
|
|
54
|
+
format: _format,
|
|
55
|
+
lng: lng,
|
|
56
|
+
options: options
|
|
57
|
+
});
|
|
52
58
|
return newValue;
|
|
53
59
|
}
|
|
54
60
|
return (0, _customFormatters.lowerCaseDynamicTextFormatter)(newValue, _format);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i18n.js","names":["_i18next","_interopRequireDefault","require","_i18nextBrowserLanguagedetector","_ramda","_reactI18next","_utils","_customFormatters","_customPostProcessors","_en","taxonomies","exports","initializeI18n","hostTranslations","_window$globalProps","packageTranslations","preval","commonsTranslations","en","translation","commonsEn","resources","reduce","mergeDeepLeft","defaultTaxonomyKeys","Object","keys","taxonomyDefaultLabels","defaultTaxonomies","fromEntries","map","key","singular","plural","hostTaxonomies","window","globalProps","replaceNullValuesWithGetter","i18n","use","LanguageDetector","initReactI18next","sentenceCaseProcessor","init","fallbackLng","interpolation","defaultVariables","escapeValue","skipOnVariables","alwaysFormat","format","value","lng","options","newValue","
|
|
1
|
+
{"version":3,"file":"i18n.js","names":["_i18next","_interopRequireDefault","require","_i18nextBrowserLanguagedetector","_ramda","_reactI18next","_constants","_utils","_customFormatters","_customPostProcessors","_en","taxonomies","exports","initializeI18n","hostTranslations","_window$globalProps","packageTranslations","preval","commonsTranslations","en","translation","commonsEn","resources","reduce","mergeDeepLeft","defaultTaxonomyKeys","Object","keys","taxonomyDefaultLabels","defaultTaxonomies","fromEntries","map","key","singular","plural","hostTaxonomies","window","globalProps","replaceNullValuesWithGetter","i18n","use","LanguageDetector","initReactI18next","sentenceCaseProcessor","init","fallbackLng","interpolation","defaultVariables","escapeValue","skipOnVariables","alwaysFormat","format","value","lng","options","newValue","LIST_FORMATS","includes","listFormatter","lowerCaseDynamicTextFormatter","postProcess","name","detection","order","caches","lookupQuerystring","lookupCookie","_default"],"sources":["../../../src/initializers/i18n.js"],"sourcesContent":["import i18n from \"i18next\";\nimport LanguageDetector from \"i18next-browser-languagedetector\";\nimport { mergeDeepLeft } from \"ramda\";\nimport { initReactI18next } from \"react-i18next\";\n\nimport { LIST_FORMATS } from \"./constants\";\nimport { replaceNullValuesWithGetter } from \"./utils\";\nimport {\n listFormatter,\n lowerCaseDynamicTextFormatter,\n} from \"./utils/customFormatters\";\nimport { sentenceCaseProcessor } from \"./utils/customPostProcessors\";\n\nimport commonsEn from \"../translations/en.json\";\n\n// eslint-disable-next-line import/no-mutable-exports\nlet taxonomies = {};\n\nconst initializeI18n = hostTranslations => {\n // eslint-disable-next-line no-undef\n const packageTranslations = preval.require(\n \"../configs/scripts/getPkgTranslations.js\"\n );\n\n const commonsTranslations = { en: { translation: commonsEn } };\n\n const resources = [\n hostTranslations,\n commonsTranslations,\n packageTranslations,\n ].reduce(mergeDeepLeft);\n\n const defaultTaxonomyKeys = Object.keys(\n resources.en.translation.taxonomyDefaultLabels || {}\n );\n\n const defaultTaxonomies = Object.fromEntries(\n defaultTaxonomyKeys.map(key => [key, { singular: null, plural: null }])\n );\n\n const hostTaxonomies = window.globalProps?.taxonomies || {};\n\n taxonomies = replaceNullValuesWithGetter(\n mergeDeepLeft(hostTaxonomies, defaultTaxonomies)\n );\n\n i18n\n .use(LanguageDetector)\n .use(initReactI18next)\n .use(sentenceCaseProcessor)\n .init({\n resources,\n fallbackLng: \"en\",\n interpolation: {\n defaultVariables: { taxonomies },\n escapeValue: false,\n skipOnVariables: false,\n alwaysFormat: true,\n format: (value, format, lng, options) => {\n let newValue = value;\n\n if (LIST_FORMATS.includes(format)) {\n newValue = listFormatter({ value: newValue, format, lng, options });\n\n return newValue;\n }\n\n return lowerCaseDynamicTextFormatter(newValue, format);\n },\n },\n postProcess: [sentenceCaseProcessor.name],\n detection: {\n order: [\"querystring\", \"cookie\", \"navigator\", \"path\"],\n caches: [\"cookie\"],\n lookup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;EACF,CAAC,CAAC;AACN,CAAC;AAAC,IAAAC,QAAA,GAIatD,cAAc;AAAAD,OAAA,cAAAuD,QAAA"}
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.lowerCaseDynamicTextFormatter = exports.
|
|
7
|
+
exports.lowerCaseDynamicTextFormatter = exports.listFormatter = void 0;
|
|
8
8
|
var _dompurify = _interopRequireDefault(require("dompurify"));
|
|
9
9
|
var _constants = require("../constants");
|
|
10
10
|
var sanitizer = function sanitizer(array) {
|
|
@@ -25,19 +25,28 @@ var fetchCachedOrInvoke = function fetchCachedOrInvoke(func, lng, options) {
|
|
|
25
25
|
return cache;
|
|
26
26
|
};
|
|
27
27
|
var lowerCaseDynamicTextFormatter = function lowerCaseDynamicTextFormatter(value, format) {
|
|
28
|
-
if (!value || format === _constants.
|
|
28
|
+
if (!value || format === _constants.FORMATS.anyCase || typeof value !== "string") {
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
29
31
|
return _constants.LOWERCASED + value.toLocaleLowerCase();
|
|
30
32
|
};
|
|
31
33
|
exports.lowerCaseDynamicTextFormatter = lowerCaseDynamicTextFormatter;
|
|
32
|
-
var
|
|
34
|
+
var listFormatter = function listFormatter(_ref) {
|
|
35
|
+
var value = _ref.value,
|
|
36
|
+
format = _ref.format,
|
|
37
|
+
lng = _ref.lng,
|
|
38
|
+
options = _ref.options;
|
|
33
39
|
var formatter = fetchCachedOrInvoke(function (lng, options) {
|
|
34
40
|
return new Intl.ListFormat(lng, options);
|
|
35
41
|
}, lng, options);
|
|
36
|
-
var
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
42
|
+
var newValue = value;
|
|
43
|
+
if (format === _constants.FORMATS.boldList) {
|
|
44
|
+
newValue = value.map(function (item) {
|
|
45
|
+
return "<strong>".concat(item, "</strong>");
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
var sanitizedItems = sanitizer(newValue).split(",");
|
|
40
49
|
return formatter.format(sanitizedItems);
|
|
41
50
|
};
|
|
42
|
-
exports.
|
|
51
|
+
exports.listFormatter = listFormatter;
|
|
43
52
|
//# sourceMappingURL=customFormatters.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customFormatters.js","names":["_dompurify","_interopRequireDefault","require","_constants","sanitizer","array","DOMPurify","sanitize","USE_PROFILES","html","cacheStore","Map","fetchCachedOrInvoke","func","lng","options","_cacheStore$get","cache","get","lngCache","set","lowerCaseDynamicTextFormatter","value","format","
|
|
1
|
+
{"version":3,"file":"customFormatters.js","names":["_dompurify","_interopRequireDefault","require","_constants","sanitizer","array","DOMPurify","sanitize","USE_PROFILES","html","cacheStore","Map","fetchCachedOrInvoke","func","lng","options","_cacheStore$get","cache","get","lngCache","set","lowerCaseDynamicTextFormatter","value","format","FORMATS","anyCase","LOWERCASED","toLocaleLowerCase","exports","listFormatter","_ref","formatter","Intl","ListFormat","newValue","boldList","map","item","concat","sanitizedItems","split"],"sources":["../../../../src/initializers/utils/customFormatters.js"],"sourcesContent":["import DOMPurify from \"dompurify\";\n\nimport { LOWERCASED, FORMATS } from \"../constants\";\n\nconst sanitizer = array =>\n DOMPurify.sanitize(array, { USE_PROFILES: { html: true } });\n\nconst cacheStore = new Map();\n\nconst fetchCachedOrInvoke = (func, lng, options) => {\n let cache = cacheStore.get(lng)?.get(options);\n if (cache) return cache;\n\n cache = func(lng, options);\n const lngCache = cacheStore.get(lng);\n if (lngCache) lngCache.set(options, cache);\n else cacheStore.set(lng, new Map([[options, cache]]));\n\n return cache;\n};\n\nexport const lowerCaseDynamicTextFormatter = (value, format) => {\n if (!value || format === FORMATS.anyCase || typeof value !== \"string\") {\n return value;\n }\n\n return LOWERCASED + value.toLocaleLowerCase();\n};\n\nexport const listFormatter = ({ value, format, lng, options }) => {\n const formatter = fetchCachedOrInvoke(\n (lng, options) => new Intl.ListFormat(lng, options),\n lng,\n options\n );\n\n let newValue = value;\n if (format === FORMATS.boldList) {\n newValue = value.map(item => `<strong>${item}</strong>`);\n }\n const sanitizedItems = sanitizer(newValue).split(\",\");\n\n return formatter.format(sanitizedItems);\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAME,SAAS,GAAG,SAAZA,SAASA,CAAGC,KAAK;EAAA,OACrBC,qBAAS,CAACC,QAAQ,CAACF,KAAK,EAAE;IAAEG,YAAY,EAAE;MAAEC,IAAI,EAAE;IAAK;EAAE,CAAC,CAAC;AAAA;AAE7D,IAAMC,UAAU,GAAG,IAAIC,GAAG,EAAE;AAE5B,IAAMC,mBAAmB,GAAG,SAAtBA,mBAAmBA,CAAIC,IAAI,EAAEC,GAAG,EAAEC,OAAO,EAAK;EAAA,IAAAC,eAAA;EAClD,IAAIC,KAAK,IAAAD,eAAA,GAAGN,UAAU,CAACQ,GAAG,CAACJ,GAAG,CAAC,cAAAE,eAAA,uBAAnBA,eAAA,CAAqBE,GAAG,CAACH,OAAO,CAAC;EAC7C,IAAIE,KAAK,EAAE,OAAOA,KAAK;EAEvBA,KAAK,GAAGJ,IAAI,CAACC,GAAG,EAAEC,OAAO,CAAC;EAC1B,IAAMI,QAAQ,GAAGT,UAAU,CAACQ,GAAG,CAACJ,GAAG,CAAC;EACpC,IAAIK,QAAQ,EAAEA,QAAQ,CAACC,GAAG,CAACL,OAAO,EAAEE,KAAK,CAAC,CAAC,KACtCP,UAAU,CAACU,GAAG,CAACN,GAAG,EAAE,IAAIH,GAAG,CAAC,CAAC,CAACI,OAAO,EAAEE,KAAK,CAAC,CAAC,CAAC,CAAC;EAErD,OAAOA,KAAK;AACd,CAAC;AAEM,IAAMI,6BAA6B,GAAG,SAAhCA,6BAA6BA,CAAIC,KAAK,EAAEC,MAAM,EAAK;EAC9D,IAAI,CAACD,KAAK,IAAIC,MAAM,KAAKC,kBAAO,CAACC,OAAO,IAAI,OAAOH,KAAK,KAAK,QAAQ,EAAE;IACrE,OAAOA,KAAK;EACd;EAEA,OAAOI,qBAAU,GAAGJ,KAAK,CAACK,iBAAiB,EAAE;AAC/C,CAAC;AAACC,OAAA,CAAAP,6BAAA,GAAAA,6BAAA;AAEK,IAAMQ,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAAwC;EAAA,IAAlCR,KAAK,GAAAQ,IAAA,CAALR,KAAK;IAAEC,MAAM,GAAAO,IAAA,CAANP,MAAM;IAAET,GAAG,GAAAgB,IAAA,CAAHhB,GAAG;IAAEC,OAAO,GAAAe,IAAA,CAAPf,OAAO;EACzD,IAAMgB,SAAS,GAAGnB,mBAAmB,CACnC,UAACE,GAAG,EAAEC,OAAO;IAAA,OAAK,IAAIiB,IAAI,CAACC,UAAU,CAACnB,GAAG,EAAEC,OAAO,CAAC;EAAA,GACnDD,GAAG,EACHC,OAAO,CACR;EAED,IAAImB,QAAQ,GAAGZ,KAAK;EACpB,IAAIC,MAAM,KAAKC,kBAAO,CAACW,QAAQ,EAAE;IAC/BD,QAAQ,GAAGZ,KAAK,CAACc,GAAG,CAAC,UAAAC,IAAI;MAAA,kBAAAC,MAAA,CAAeD,IAAI;IAAA,CAAW,CAAC;EAC1D;EACA,IAAME,cAAc,GAAGnC,SAAS,CAAC8B,QAAQ,CAAC,CAACM,KAAK,CAAC,GAAG,CAAC;EAErD,OAAOT,SAAS,CAACR,MAAM,CAACgB,cAAc,CAAC;AACzC,CAAC;AAACX,OAAA,CAAAC,aAAA,GAAAA,aAAA"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
{
|
|
2
|
+
"generic": {
|
|
3
|
+
"error": "Something went wrong. Please try again later."
|
|
4
|
+
},
|
|
5
|
+
"authentication": {
|
|
6
|
+
"notLoggedIn": "Could not authenticate, please login to continue!",
|
|
7
|
+
"couldNotAuth": "Could not authenticate with the provided {{parameter}}.",
|
|
8
|
+
"incorrectPassword": "Current password is incorrect. Please try again.",
|
|
9
|
+
"incorrectEmailPassword": "Incorrect email or password. Please try again."
|
|
10
|
+
},
|
|
11
|
+
"authorization": {
|
|
12
|
+
"unauthorized": "You are not authorized to perform this action."
|
|
13
|
+
},
|
|
14
|
+
"resource": {
|
|
15
|
+
"add_one": "{{entity}} has been added successfully.",
|
|
16
|
+
"add_other": "{{entity}} have been added successfully.",
|
|
17
|
+
"save": "{{entity}} has been saved successfully.",
|
|
18
|
+
"save_one": "{{entity}} has been saved successfully.",
|
|
19
|
+
"save_other": "{{entity}} have been saved successfully.",
|
|
20
|
+
"update": "{{entity}} has been updated successfully.",
|
|
21
|
+
"update_one": "{{entity}} has been updated successfully.",
|
|
22
|
+
"update_other": "{{entity}} have been updated successfully.",
|
|
23
|
+
"delete_one": "{{entity}} has been deleted successfully.",
|
|
24
|
+
"delete_other": "{{entity}} have been deleted successfully.",
|
|
25
|
+
"clone": "{{entity}} has been cloned successfully.",
|
|
26
|
+
"notFound": "{{entity}} does not exist.",
|
|
27
|
+
"remove_one": "{{entity}} has been removed successfully.",
|
|
28
|
+
"remove_other": "{{entity}} have been removed successfully.",
|
|
29
|
+
"sent": "{{entity}} sent successfully.",
|
|
30
|
+
"merged": "{{entity}} have been successfully merged.",
|
|
31
|
+
"disconnected": "{{entity}} has been successfully disconnected."
|
|
32
|
+
},
|
|
33
|
+
"otp": {
|
|
34
|
+
"sent": "OTP has been sent successfully.",
|
|
35
|
+
"invalid": "Invalid OTP",
|
|
36
|
+
"verified": "OTP has been verified successfully."
|
|
37
|
+
},
|
|
38
|
+
"upload": {
|
|
39
|
+
"error": "An error occurred while uploading the file"
|
|
40
|
+
},
|
|
41
|
+
"image": {
|
|
42
|
+
"profile": {
|
|
43
|
+
"removalFailed": "Failed to remove profile picture",
|
|
44
|
+
"removalSuccess": "Profile picture successfully removed"
|
|
45
|
+
},
|
|
46
|
+
"contentTypeInvalid": "Other than jpg, png, svg are not supported",
|
|
47
|
+
"sizeOutOfRange": "Should not be more than {{maxSize, number}} MB"
|
|
48
|
+
},
|
|
49
|
+
"userRole": {
|
|
50
|
+
"deactivateActiveAdmin": "You cannot deactivate active admin from the organization!"
|
|
51
|
+
},
|
|
52
|
+
"activeRecord": {
|
|
53
|
+
"error": {
|
|
54
|
+
"blankName": "Name can't be blank",
|
|
55
|
+
"blankDescription": "Description can't be blank",
|
|
56
|
+
"blankValue": "Value can't be blank",
|
|
57
|
+
"prefixType": "Prefix type {{value}} is not valid",
|
|
58
|
+
"minimumEntryLimit": "Minimum entry limit must be less than or equal to {{maximumEntryLimit, number}}",
|
|
59
|
+
"maximumEntryLimit": "Maximum entry limit must be greater than or equal to {{minimumEntryLimit, number}}"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"sessions": {
|
|
63
|
+
"expiry": "Your session has expired. Please login again."
|
|
64
|
+
},
|
|
65
|
+
"payment": {
|
|
66
|
+
"error": {
|
|
67
|
+
"incomplete": "Your payment could not be completed"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"invitations": {
|
|
71
|
+
"deleted_one": "Invitation has been deleted successfully",
|
|
72
|
+
"deleted_other": "{{count, number}} Invitations have been deleted successfully",
|
|
73
|
+
"sent_one": "Invitation has been sent successfully",
|
|
74
|
+
"sent_other": "{{count, number}} Invitations have been sent successfully",
|
|
75
|
+
"notFound": "{{email}} was not invited to test this website."
|
|
76
|
+
},
|
|
77
|
+
"github": {
|
|
78
|
+
"error": {
|
|
79
|
+
"webhookPermissionDenied": "Permission denied. Ensure you have permission to create webhooks for the repository.",
|
|
80
|
+
"primaryNonDeletable": "Primary Github account cannot be deleted."
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"neetoCommons": {
|
|
84
|
+
"fallbackComponent": {
|
|
85
|
+
"somethingWentWrong": "Sorry, something went wrong.",
|
|
86
|
+
"description": "Please try <reloading>reloading</reloading> the page.<br> If the problem persists, <contactus>contact us</contactus>."
|
|
87
|
+
},
|
|
88
|
+
"toastr": {
|
|
89
|
+
"success": {
|
|
90
|
+
"copiedToClipboard": "Copied to clipboard!"
|
|
91
|
+
},
|
|
92
|
+
"error": {
|
|
93
|
+
"networkError": "No Internet Connection"
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"notice": {
|
|
97
|
+
"errorOccurred": "Some error occurred."
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
@@ -16,15 +16,11 @@ module.exports = {
|
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
files: ["app/javascript/packs/**/*.{js,jsx}"],
|
|
19
|
-
rules: {
|
|
20
|
-
"no-redeclare": "off",
|
|
21
|
-
},
|
|
19
|
+
rules: { "no-redeclare": "off" },
|
|
22
20
|
},
|
|
23
21
|
{
|
|
24
|
-
files: ["**/*.spec.js", "**/*.spec.jsx"],
|
|
25
|
-
env: {
|
|
26
|
-
jest: true,
|
|
27
|
-
},
|
|
22
|
+
files: ["**/*.spec.js", "**/*.spec.jsx", "**/*.test.jsx"],
|
|
23
|
+
env: { jest: true },
|
|
28
24
|
},
|
|
29
25
|
],
|
|
30
26
|
};
|
package/configs/webpack/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { keysToCamelCase, matches, serializeKeysToSnakeCase } from "@bigbinary/n
|
|
|
6
6
|
import { useErrorDisplayStore } from "@bigbinary/neeto-commons-frontend/react-utils";
|
|
7
7
|
import { resetAuthTokens } from "@bigbinary/neeto-commons-frontend/utils";
|
|
8
8
|
import { Toastr } from "@bigbinary/neetoui";
|
|
9
|
-
import { evolve, omit
|
|
9
|
+
import { evolve, omit } from "ramda";
|
|
10
10
|
import setParamsSerializer from "./paramsSerializer";
|
|
11
11
|
import { HEADERS_KEYS } from "../constants";
|
|
12
12
|
var shouldNot = function shouldNot(skip) {
|
|
@@ -95,7 +95,6 @@ var handleUnauthorizedErrorResponse = function handleUnauthorizedErrorResponse(e
|
|
|
95
95
|
if (redirectOnError) {
|
|
96
96
|
setTimeout(function () {
|
|
97
97
|
var redirectTo = window.location.pathname === "/login" ? "/login" : "/login?redirect_uri=".concat(encodeURIComponent(window.location.href));
|
|
98
|
-
// eslint-disable-next-line xss/no-location-href-assign
|
|
99
98
|
window.location.href = redirectTo;
|
|
100
99
|
}, 300);
|
|
101
100
|
}
|
|
@@ -156,7 +155,7 @@ var cleanupCredentialsForCrossOrigin = function cleanupCredentialsForCrossOrigin
|
|
|
156
155
|
if (!request.url.includes("://")) return request;
|
|
157
156
|
if (request.url.includes(window.location.hostname)) return request;
|
|
158
157
|
return evolve({
|
|
159
|
-
headers: omit(
|
|
158
|
+
headers: omit([HEADERS_KEYS.xCsrfToken])
|
|
160
159
|
})(request);
|
|
161
160
|
};
|
|
162
161
|
var transformDataToSnakeCase = function transformDataToSnakeCase(request) {
|