@fctc/interface-logic 4.1.2 → 4.1.3

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/configs.js CHANGED
@@ -2252,6 +2252,9 @@ var sessionStorageUtils = /* @__PURE__ */ (() => {
2252
2252
  })();
2253
2253
 
2254
2254
  // src/configs/axios-client.ts
2255
+ function removeLanguages(acceptLang, removeList) {
2256
+ return acceptLang.split(",").map((x) => x.trim()).filter((item) => !removeList?.some((lang) => item?.startsWith(lang))).join(",");
2257
+ }
2255
2258
  var axiosClient = {
2256
2259
  init(config) {
2257
2260
  const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
@@ -2277,9 +2280,11 @@ var axiosClient = {
2277
2280
  paramsSerializer: (params) => new URLSearchParams(params).toString()
2278
2281
  });
2279
2282
  instance.interceptors.request.use(async (configReq) => {
2283
+ const rawLang = navigator.languages?.join(",") || navigator.language;
2280
2284
  const useRefreshToken = configReq.headers["X-Use-Refresh-Token"] === "true";
2281
2285
  const useActionToken = configReq.headers["X-Use-Action-Token"] === "true";
2282
2286
  const actionToken = configReq.headers["X-Action-Token"];
2287
+ const cleaned = removeLanguages(rawLang, config?.excludeLanguages);
2283
2288
  let token = null;
2284
2289
  if (useActionToken && actionToken) {
2285
2290
  token = actionToken;
@@ -2293,6 +2298,7 @@ var axiosClient = {
2293
2298
  if (database) {
2294
2299
  configReq.headers["DATABASE"] = database;
2295
2300
  }
2301
+ configReq.headers["Accept-Language"] = cleaned;
2296
2302
  return configReq;
2297
2303
  }, Promise.reject);
2298
2304
  const buildRefreshUrl = () => {
package/dist/configs.mjs CHANGED
@@ -2216,6 +2216,9 @@ var sessionStorageUtils = /* @__PURE__ */ (() => {
2216
2216
  })();
2217
2217
 
2218
2218
  // src/configs/axios-client.ts
2219
+ function removeLanguages(acceptLang, removeList) {
2220
+ return acceptLang.split(",").map((x) => x.trim()).filter((item) => !removeList?.some((lang) => item?.startsWith(lang))).join(",");
2221
+ }
2219
2222
  var axiosClient = {
2220
2223
  init(config) {
2221
2224
  const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
@@ -2241,9 +2244,11 @@ var axiosClient = {
2241
2244
  paramsSerializer: (params) => new URLSearchParams(params).toString()
2242
2245
  });
2243
2246
  instance.interceptors.request.use(async (configReq) => {
2247
+ const rawLang = navigator.languages?.join(",") || navigator.language;
2244
2248
  const useRefreshToken = configReq.headers["X-Use-Refresh-Token"] === "true";
2245
2249
  const useActionToken = configReq.headers["X-Use-Action-Token"] === "true";
2246
2250
  const actionToken = configReq.headers["X-Action-Token"];
2251
+ const cleaned = removeLanguages(rawLang, config?.excludeLanguages);
2247
2252
  let token = null;
2248
2253
  if (useActionToken && actionToken) {
2249
2254
  token = actionToken;
@@ -2257,6 +2262,7 @@ var axiosClient = {
2257
2262
  if (database) {
2258
2263
  configReq.headers["DATABASE"] = database;
2259
2264
  }
2265
+ configReq.headers["Accept-Language"] = cleaned;
2260
2266
  return configReq;
2261
2267
  }, Promise.reject);
2262
2268
  const buildRefreshUrl = () => {
@@ -2254,6 +2254,9 @@ var sessionStorageUtils = /* @__PURE__ */ (() => {
2254
2254
  })();
2255
2255
 
2256
2256
  // src/configs/axios-client.ts
2257
+ function removeLanguages(acceptLang, removeList) {
2258
+ return acceptLang.split(",").map((x) => x.trim()).filter((item) => !removeList?.some((lang) => item?.startsWith(lang))).join(",");
2259
+ }
2257
2260
  var axiosClient = {
2258
2261
  init(config) {
2259
2262
  const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
@@ -2279,9 +2282,11 @@ var axiosClient = {
2279
2282
  paramsSerializer: (params) => new URLSearchParams(params).toString()
2280
2283
  });
2281
2284
  instance.interceptors.request.use(async (configReq) => {
2285
+ const rawLang = navigator.languages?.join(",") || navigator.language;
2282
2286
  const useRefreshToken = configReq.headers["X-Use-Refresh-Token"] === "true";
2283
2287
  const useActionToken = configReq.headers["X-Use-Action-Token"] === "true";
2284
2288
  const actionToken = configReq.headers["X-Action-Token"];
2289
+ const cleaned = removeLanguages(rawLang, config?.excludeLanguages);
2285
2290
  let token = null;
2286
2291
  if (useActionToken && actionToken) {
2287
2292
  token = actionToken;
@@ -2295,6 +2300,7 @@ var axiosClient = {
2295
2300
  if (database) {
2296
2301
  configReq.headers["DATABASE"] = database;
2297
2302
  }
2303
+ configReq.headers["Accept-Language"] = cleaned;
2298
2304
  return configReq;
2299
2305
  }, Promise.reject);
2300
2306
  const buildRefreshUrl = () => {
@@ -2216,6 +2216,9 @@ var sessionStorageUtils = /* @__PURE__ */ (() => {
2216
2216
  })();
2217
2217
 
2218
2218
  // src/configs/axios-client.ts
2219
+ function removeLanguages(acceptLang, removeList) {
2220
+ return acceptLang.split(",").map((x) => x.trim()).filter((item) => !removeList?.some((lang) => item?.startsWith(lang))).join(",");
2221
+ }
2219
2222
  var axiosClient = {
2220
2223
  init(config) {
2221
2224
  const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
@@ -2241,9 +2244,11 @@ var axiosClient = {
2241
2244
  paramsSerializer: (params) => new URLSearchParams(params).toString()
2242
2245
  });
2243
2246
  instance.interceptors.request.use(async (configReq) => {
2247
+ const rawLang = navigator.languages?.join(",") || navigator.language;
2244
2248
  const useRefreshToken = configReq.headers["X-Use-Refresh-Token"] === "true";
2245
2249
  const useActionToken = configReq.headers["X-Use-Action-Token"] === "true";
2246
2250
  const actionToken = configReq.headers["X-Action-Token"];
2251
+ const cleaned = removeLanguages(rawLang, config?.excludeLanguages);
2247
2252
  let token = null;
2248
2253
  if (useActionToken && actionToken) {
2249
2254
  token = actionToken;
@@ -2257,6 +2262,7 @@ var axiosClient = {
2257
2262
  if (database) {
2258
2263
  configReq.headers["DATABASE"] = database;
2259
2264
  }
2265
+ configReq.headers["Accept-Language"] = cleaned;
2260
2266
  return configReq;
2261
2267
  }, Promise.reject);
2262
2268
  const buildRefreshUrl = () => {
@@ -46,6 +46,7 @@ interface EnvConfig {
46
46
  sessionStorageUtils?: any;
47
47
  envFile?: any;
48
48
  xNode?: string;
49
+ excludeLanguages?: string[];
49
50
  }
50
51
  declare function EnvProvider({ children, localStorageUtils: localStorageUtil, sessionStorageUtils: sessionStorageUtil, }: {
51
52
  children: React.ReactNode;
@@ -46,6 +46,7 @@ interface EnvConfig {
46
46
  sessionStorageUtils?: any;
47
47
  envFile?: any;
48
48
  xNode?: string;
49
+ excludeLanguages?: string[];
49
50
  }
50
51
  declare function EnvProvider({ children, localStorageUtils: localStorageUtil, sessionStorageUtils: sessionStorageUtil, }: {
51
52
  children: React.ReactNode;
package/dist/provider.js CHANGED
@@ -5976,6 +5976,9 @@ var import_react14 = require("react");
5976
5976
 
5977
5977
  // src/configs/axios-client.ts
5978
5978
  var import_axios = __toESM(require("axios"));
5979
+ function removeLanguages(acceptLang, removeList) {
5980
+ return acceptLang.split(",").map((x) => x.trim()).filter((item) => !removeList?.some((lang) => item?.startsWith(lang))).join(",");
5981
+ }
5979
5982
  var axiosClient = {
5980
5983
  init(config) {
5981
5984
  const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
@@ -6001,9 +6004,11 @@ var axiosClient = {
6001
6004
  paramsSerializer: (params) => new URLSearchParams(params).toString()
6002
6005
  });
6003
6006
  instance.interceptors.request.use(async (configReq) => {
6007
+ const rawLang = navigator.languages?.join(",") || navigator.language;
6004
6008
  const useRefreshToken = configReq.headers["X-Use-Refresh-Token"] === "true";
6005
6009
  const useActionToken = configReq.headers["X-Use-Action-Token"] === "true";
6006
6010
  const actionToken = configReq.headers["X-Action-Token"];
6011
+ const cleaned = removeLanguages(rawLang, config?.excludeLanguages);
6007
6012
  let token = null;
6008
6013
  if (useActionToken && actionToken) {
6009
6014
  token = actionToken;
@@ -6017,6 +6022,7 @@ var axiosClient = {
6017
6022
  if (database) {
6018
6023
  configReq.headers["DATABASE"] = database;
6019
6024
  }
6025
+ configReq.headers["Accept-Language"] = cleaned;
6020
6026
  return configReq;
6021
6027
  }, Promise.reject);
6022
6028
  const buildRefreshUrl = () => {
@@ -6315,7 +6321,8 @@ var initialEnvState = {
6315
6321
  uid: null,
6316
6322
  lang: "vi_VN",
6317
6323
  tz: "Asia/Saigon"
6318
- }
6324
+ },
6325
+ excludeLanguages: []
6319
6326
  };
6320
6327
  var EnvContext = (0, import_react14.createContext)(null);
6321
6328
  function EnvProvider({
package/dist/provider.mjs CHANGED
@@ -5933,6 +5933,9 @@ import { createContext, useContext, useState as useState4, useCallback as useCal
5933
5933
 
5934
5934
  // src/configs/axios-client.ts
5935
5935
  import axios from "axios";
5936
+ function removeLanguages(acceptLang, removeList) {
5937
+ return acceptLang.split(",").map((x) => x.trim()).filter((item) => !removeList?.some((lang) => item?.startsWith(lang))).join(",");
5938
+ }
5936
5939
  var axiosClient = {
5937
5940
  init(config) {
5938
5941
  const localStorage2 = config?.localStorageUtils ?? localStorageUtils();
@@ -5958,9 +5961,11 @@ var axiosClient = {
5958
5961
  paramsSerializer: (params) => new URLSearchParams(params).toString()
5959
5962
  });
5960
5963
  instance.interceptors.request.use(async (configReq) => {
5964
+ const rawLang = navigator.languages?.join(",") || navigator.language;
5961
5965
  const useRefreshToken = configReq.headers["X-Use-Refresh-Token"] === "true";
5962
5966
  const useActionToken = configReq.headers["X-Use-Action-Token"] === "true";
5963
5967
  const actionToken = configReq.headers["X-Action-Token"];
5968
+ const cleaned = removeLanguages(rawLang, config?.excludeLanguages);
5964
5969
  let token = null;
5965
5970
  if (useActionToken && actionToken) {
5966
5971
  token = actionToken;
@@ -5974,6 +5979,7 @@ var axiosClient = {
5974
5979
  if (database) {
5975
5980
  configReq.headers["DATABASE"] = database;
5976
5981
  }
5982
+ configReq.headers["Accept-Language"] = cleaned;
5977
5983
  return configReq;
5978
5984
  }, Promise.reject);
5979
5985
  const buildRefreshUrl = () => {
@@ -6272,7 +6278,8 @@ var initialEnvState = {
6272
6278
  uid: null,
6273
6279
  lang: "vi_VN",
6274
6280
  tz: "Asia/Saigon"
6275
- }
6281
+ },
6282
+ excludeLanguages: []
6276
6283
  };
6277
6284
  var EnvContext = createContext(null);
6278
6285
  function EnvProvider({
package/package.json CHANGED
@@ -1,90 +1,90 @@
1
- {
2
- "name": "@fctc/interface-logic",
3
- "version": "4.1.2",
4
- "types": "dist/index.d.ts",
5
- "main": "dist/index.cjs",
6
- "module": "dist/index.mjs",
7
- "exports": {
8
- ".": {
9
- "types": "./dist/index.d.ts",
10
- "import": "./dist/index.mjs",
11
- "require": "./dist/index.cjs"
12
- },
13
- "./configs": {
14
- "types": "./dist/configs.d.ts",
15
- "import": "./dist/configs.mjs",
16
- "require": "./dist/configs.cjs"
17
- },
18
- "./constants": {
19
- "types": "./dist/constants.d.ts",
20
- "import": "./dist/constants.mjs",
21
- "require": "./dist/constants.cjs"
22
- },
23
- "./environment": {
24
- "types": "./dist/environment.d.ts",
25
- "import": "./dist/environment.mjs",
26
- "require": "./dist/environment.cjs"
27
- },
28
- "./hooks": {
29
- "types": "./dist/hooks.d.ts",
30
- "import": "./dist/hooks.mjs",
31
- "require": "./dist/hooks.cjs"
32
- },
33
- "./provider": {
34
- "types": "./dist/provider.d.ts",
35
- "import": "./dist/provider.mjs",
36
- "require": "./dist/provider.cjs"
37
- },
38
- "./services": {
39
- "types": "./dist/services.d.ts",
40
- "import": "./dist/services.mjs",
41
- "require": "./dist/services.cjs"
42
- },
43
- "./store": {
44
- "types": "./dist/store.d.ts",
45
- "import": "./dist/store.mjs",
46
- "require": "./dist/store.cjs"
47
- },
48
- "./utils": {
49
- "types": "./dist/utils.d.ts",
50
- "import": "./dist/utils.mjs",
51
- "require": "./dist/utils.cjs"
52
- },
53
- "./types": {
54
- "types": "./dist/types.d.ts",
55
- "import": "./dist/types.mjs",
56
- "require": "./dist/types.cjs"
57
- },
58
- "./models": {
59
- "types": "./dist/models.d.ts",
60
- "import": "./dist/models.mjs",
61
- "require": "./dist/models.cjs"
62
- }
63
- },
64
- "files": [
65
- "dist"
66
- ],
67
- "scripts": {
68
- "build": "tsup",
69
- "test": "jest"
70
- },
71
- "peerDependencies": {
72
- "react": "18.0.0",
73
- "@tanstack/react-query": "^5.83.0"
74
- },
75
- "dependencies": {
76
- "@reduxjs/toolkit": "^2.8.2",
77
- "@tanstack/react-query": "^5.83.0",
78
- "axios": "^1.11.0",
79
- "moment": "^2.30.1",
80
- "react-redux": "^9.2.0"
81
- },
82
- "devDependencies": {
83
- "@types/react": "^18.3.1",
84
- "react": "18.0.0",
85
- "jest": "^29.7.0",
86
- "tsup": "^8.0.0",
87
- "typescript": "^5.8.2"
88
- },
89
- "packageManager": "yarn@1.22.0"
90
- }
1
+ {
2
+ "name": "@fctc/interface-logic",
3
+ "version": "4.1.3",
4
+ "types": "dist/index.d.ts",
5
+ "main": "dist/index.cjs",
6
+ "module": "dist/index.mjs",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.mjs",
11
+ "require": "./dist/index.cjs"
12
+ },
13
+ "./configs": {
14
+ "types": "./dist/configs.d.ts",
15
+ "import": "./dist/configs.mjs",
16
+ "require": "./dist/configs.cjs"
17
+ },
18
+ "./constants": {
19
+ "types": "./dist/constants.d.ts",
20
+ "import": "./dist/constants.mjs",
21
+ "require": "./dist/constants.cjs"
22
+ },
23
+ "./environment": {
24
+ "types": "./dist/environment.d.ts",
25
+ "import": "./dist/environment.mjs",
26
+ "require": "./dist/environment.cjs"
27
+ },
28
+ "./hooks": {
29
+ "types": "./dist/hooks.d.ts",
30
+ "import": "./dist/hooks.mjs",
31
+ "require": "./dist/hooks.cjs"
32
+ },
33
+ "./provider": {
34
+ "types": "./dist/provider.d.ts",
35
+ "import": "./dist/provider.mjs",
36
+ "require": "./dist/provider.cjs"
37
+ },
38
+ "./services": {
39
+ "types": "./dist/services.d.ts",
40
+ "import": "./dist/services.mjs",
41
+ "require": "./dist/services.cjs"
42
+ },
43
+ "./store": {
44
+ "types": "./dist/store.d.ts",
45
+ "import": "./dist/store.mjs",
46
+ "require": "./dist/store.cjs"
47
+ },
48
+ "./utils": {
49
+ "types": "./dist/utils.d.ts",
50
+ "import": "./dist/utils.mjs",
51
+ "require": "./dist/utils.cjs"
52
+ },
53
+ "./types": {
54
+ "types": "./dist/types.d.ts",
55
+ "import": "./dist/types.mjs",
56
+ "require": "./dist/types.cjs"
57
+ },
58
+ "./models": {
59
+ "types": "./dist/models.d.ts",
60
+ "import": "./dist/models.mjs",
61
+ "require": "./dist/models.cjs"
62
+ }
63
+ },
64
+ "files": [
65
+ "dist"
66
+ ],
67
+ "scripts": {
68
+ "build": "tsup",
69
+ "test": "jest"
70
+ },
71
+ "peerDependencies": {
72
+ "react": "18.0.0",
73
+ "@tanstack/react-query": "^5.83.0"
74
+ },
75
+ "dependencies": {
76
+ "@reduxjs/toolkit": "^2.8.2",
77
+ "@tanstack/react-query": "^5.83.0",
78
+ "axios": "^1.11.0",
79
+ "moment": "^2.30.1",
80
+ "react-redux": "^9.2.0"
81
+ },
82
+ "devDependencies": {
83
+ "@types/react": "^18.3.1",
84
+ "react": "18.0.0",
85
+ "jest": "^29.7.0",
86
+ "tsup": "^8.0.0",
87
+ "typescript": "^5.8.2"
88
+ },
89
+ "packageManager": "yarn@1.22.0"
90
+ }