@rpcbase/client 0.176.0 → 0.178.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auth/index.js +0 -2
- package/i18n/index.js +5 -6
- package/package.json +5 -5
package/auth/index.js
CHANGED
|
@@ -15,8 +15,6 @@ const uidStorageKey = (tenant_id) => `rb.${tenant_id}.user_id`
|
|
|
15
15
|
|
|
16
16
|
const log = debug("rb:auth")
|
|
17
17
|
|
|
18
|
-
// TODO: this should be refactored to AuthContext + Provider
|
|
19
|
-
|
|
20
18
|
let __isSignedIn = null
|
|
21
19
|
|
|
22
20
|
let __tenantId = typeof storage !== "undefined" && storage.getItem(LAST_TENANT_KEY)
|
package/i18n/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import getLocaleFromCode from "@rpcbase/std/get_locale_from_code"
|
|
|
8
8
|
|
|
9
9
|
import {RB_DEFAULT_LOCALE, RB_LOCALES} from "env"
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const RB_LOCALE_KEY = "rb.i18n_locale"
|
|
12
12
|
|
|
13
13
|
const DEFAULT_LOCALE = RB_DEFAULT_LOCALE || "en"
|
|
14
14
|
const SUPPORTED_LOCALES = !!RB_LOCALES ? RB_LOCALES.split(",").map((l) => l.trim()) : ["en"]
|
|
@@ -16,13 +16,13 @@ const SUPPORTED_LOCALES = !!RB_LOCALES ? RB_LOCALES.split(",").map((l) => l.trim
|
|
|
16
16
|
// https://github.com/i18next/i18next-browser-languageDetector
|
|
17
17
|
|
|
18
18
|
// get stored locale or fallback to navigator
|
|
19
|
-
let locale = localStorage.getItem(
|
|
19
|
+
let locale = localStorage.getItem(RB_LOCALE_KEY)
|
|
20
20
|
if (!locale) {
|
|
21
21
|
locale = navigator.language
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
//
|
|
25
|
-
export const
|
|
24
|
+
// DO NOT call this function directly, it is injected from babel-plugin-i18next-client by the bundler
|
|
25
|
+
export const initializeI18N = async (backendFn) => {
|
|
26
26
|
i18next
|
|
27
27
|
.use(ChainedBackend)
|
|
28
28
|
.use(initReactI18next)
|
|
@@ -30,7 +30,6 @@ export const registerI18N = async (backendFn) => {
|
|
|
30
30
|
lng: locale,
|
|
31
31
|
fallbackLng: (code) => {
|
|
32
32
|
const val = getLocaleFromCode({ code, supported_locales: SUPPORTED_LOCALES, default_locale: DEFAULT_LOCALE })
|
|
33
|
-
// console.log("GOT VAL", {code, val})
|
|
34
33
|
return val
|
|
35
34
|
},
|
|
36
35
|
defaultNS: "common",
|
|
@@ -49,6 +48,6 @@ export const registerI18N = async (backendFn) => {
|
|
|
49
48
|
|
|
50
49
|
// save preference to local storage so it works on reload
|
|
51
50
|
i18next.on('languageChanged', (lng) => {
|
|
52
|
-
localStorage.setItem(
|
|
51
|
+
localStorage.setItem(RB_LOCALE_KEY, lng)
|
|
53
52
|
})
|
|
54
53
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rpcbase/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.178.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"test": "../../node_modules/.bin/wireit"
|
|
6
6
|
},
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"@babel/plugin-transform-runtime": "7.24.7",
|
|
102
102
|
"@babel/preset-react": "7.24.7",
|
|
103
103
|
"@testing-library/react": "16.0.0",
|
|
104
|
-
"@testing-library/
|
|
104
|
+
"@testing-library/dom": "10.4.0",
|
|
105
105
|
"axios": "1.7.2",
|
|
106
106
|
"babel-jest": "29.7.0",
|
|
107
107
|
"bluebird": "3.7.2",
|
|
@@ -109,10 +109,10 @@
|
|
|
109
109
|
"jest-environment-jsdom": "29.7.0",
|
|
110
110
|
"lodash": "4.17.21",
|
|
111
111
|
"page": "1.11.6",
|
|
112
|
-
"react": "
|
|
113
|
-
"react-dom": "
|
|
112
|
+
"react": "19.0.0-rc-65903583-20240805",
|
|
113
|
+
"react-dom": "19.0.0-rc-65903583-20240805",
|
|
114
114
|
"react-native-web": "0.19.12",
|
|
115
|
-
"react-test-renderer": "
|
|
115
|
+
"react-test-renderer": "19.0.0-rc-65903583-20240805",
|
|
116
116
|
"validator": "13.12.0",
|
|
117
117
|
"webpack": "5.93.0",
|
|
118
118
|
"webpack-cli": "5.1.4"
|