thecore-auth 0.0.216 → 0.0.218
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/README.md +29 -0
- package/dist/thecore-auth.cjs.js +41 -41
- package/dist/thecore-auth.esm.js +5610 -5474
- package/package.json +8 -2
package/README.md
CHANGED
|
@@ -77,6 +77,7 @@ Create a file `public/config.json` in your project. This file is loaded at runti
|
|
|
77
77
|
"backendToken": "",
|
|
78
78
|
"isDebug": false,
|
|
79
79
|
"tokenLog": false,
|
|
80
|
+
"environmentInfoLog": false,
|
|
80
81
|
"isDevelopment": false,
|
|
81
82
|
"hasSessionKey": false,
|
|
82
83
|
"appKey": "myapp",
|
|
@@ -137,6 +138,7 @@ Create a file `public/config.json` in your project. This file is loaded at runti
|
|
|
137
138
|
| `routes` | `array` | Array of `{ path, title }` for automatic page title updates |
|
|
138
139
|
| `configRoutes` | `array` | Additional custom routes injected by the package |
|
|
139
140
|
| `tokenLog` | `boolean` | Log JWT token details to the console (debug) |
|
|
141
|
+
| `environmentInfoLog` | `boolean` | Log every `useEnvironmentInfo` read to the console (debug); missing or `false` disables logging |
|
|
140
142
|
| `showHeaderButton` | `boolean` | Show a logout button in the default header |
|
|
141
143
|
| `useCustomLoginTimeout` | `boolean` | Enable a custom timeout for the login request |
|
|
142
144
|
| `customLoginTimeout` | `number` | Timeout (ms) for the login request when `useCustomLoginTimeout` is `true` |
|
|
@@ -857,6 +859,32 @@ const { isMobile, isDesktop, os, browser } = useDevice();
|
|
|
857
859
|
|
|
858
860
|
---
|
|
859
861
|
|
|
862
|
+
### useEnvironmentInfo
|
|
863
|
+
|
|
864
|
+
[→ Full reference](https://github.com/SantiGalvan/thecore-auth/blob/main/docs/en/hooks/useEnvironmentInfo.md)
|
|
865
|
+
|
|
866
|
+
Reads browser/device signals that do not require a permission prompt (hardware, locale, connectivity, media-query preferences, storage estimate). Every read is logged to the console only when `environmentInfoLog` is `true` in `config.json`; if the key is missing or `false`, the hook still works normally and simply stays silent.
|
|
867
|
+
|
|
868
|
+
```jsx
|
|
869
|
+
import { useEnvironmentInfo } from 'thecore-auth';
|
|
870
|
+
|
|
871
|
+
const { hardwareConcurrency, language, isOnline, connection, capabilities } = useEnvironmentInfo();
|
|
872
|
+
```
|
|
873
|
+
|
|
874
|
+
| Returned value | Type | Description |
|
|
875
|
+
|----------------|------|-------------|
|
|
876
|
+
| `hardwareConcurrency`, `deviceMemory`, `maxTouchPoints`, `cookieEnabled`, `screen`, `userAgentData` | — | Static values, computed once |
|
|
877
|
+
| `capabilities` | `object` | Presence flags: `bluetooth`, `usb`, `serial`, `hid`, `wakeLock`, `share`, `clipboard`, `serviceWorker`, `gpu`, `gamepads`, `geolocation`, `permissions`, `xr` |
|
|
878
|
+
| `language`, `languages`, `timeZone`, `locale` | — | Re-read on `languagechange` |
|
|
879
|
+
| `devicePixelRatio` | `number` | Re-read on `resize` |
|
|
880
|
+
| `orientation` | `object` | Re-read on `screen.orientation` `change` |
|
|
881
|
+
| `isOnline` | `boolean` | Re-read on `online`/`offline` |
|
|
882
|
+
| `connection` | `object \| undefined` | `navigator.connection` snapshot, re-read on its `change` event |
|
|
883
|
+
| `prefersColorSchemeDark`, `prefersReducedMotion`, `prefersContrastMore`, `forcedColorsActive`, `prefersReducedData`, `isStandalonePwa` | `boolean` | Media-query preferences, each independently reactive |
|
|
884
|
+
| `storageUsage`, `storageQuota`, `refreshStorageEstimate` | — | `navigator.storage.estimate()`, read once at mount; call `refreshStorageEstimate()` to re-read |
|
|
885
|
+
|
|
886
|
+
---
|
|
887
|
+
|
|
860
888
|
### useOrientation
|
|
861
889
|
|
|
862
890
|
[→ Full reference](https://github.com/SantiGalvan/thecore-auth/blob/main/docs/en/hooks/useOrientation.md)
|
|
@@ -1110,6 +1138,7 @@ my-app/
|
|
|
1110
1138
|
"backendToken": "",
|
|
1111
1139
|
"isDebug": false,
|
|
1112
1140
|
"tokenLog": false,
|
|
1141
|
+
"environmentInfoLog": false,
|
|
1113
1142
|
"isDevelopment": false,
|
|
1114
1143
|
"hasSessionKey": false,
|
|
1115
1144
|
"appKey": "myapp",
|